Group plays to hooks
This commit is contained in:
parent
0079925738
commit
c099827d88
42
plays/commonlib/vars.yml
Normal file
42
plays/commonlib/vars.yml
Normal file
@ -0,0 +1,42 @@
|
||||
---
|
||||
- name: Check if internal system variables exists
|
||||
stat:
|
||||
path: "{{ plugin_config_root }}/vars.yml"
|
||||
register: vars_yml
|
||||
|
||||
- name: Load internal system variables
|
||||
no_log: true
|
||||
when: vars_yml.stat.exists
|
||||
include_vars:
|
||||
file: "{{ plugin_config_root }}/vars.yml"
|
||||
|
||||
- name: Export internal deployment variables
|
||||
set_fact:
|
||||
dokku_mariadb_db_addr: "dokku-mariadb-{{ app }}"
|
||||
dokku_mariadb_db_user: "mariadb"
|
||||
dokku_hostname: "{{ lookup('file', '/home/dokku/HOSTNAME') }}"
|
||||
|
||||
- name: Check if the application config file exists
|
||||
stat:
|
||||
path: "{{ app_config_root }}/config.yml"
|
||||
register: config_yml
|
||||
|
||||
- name: Load unencrypted configuration variables
|
||||
no_log: true
|
||||
when: config_yml.stat.exists
|
||||
include_vars:
|
||||
file: "{{ app_config_root }}/config.yml"
|
||||
|
||||
- name: Check if an application vault directory exists
|
||||
stat:
|
||||
path: "{{ app_config_root }}/vault"
|
||||
register: vault_dir
|
||||
|
||||
- name: Load application encrypted vault variables
|
||||
no_log: true
|
||||
when: vault_dir.stat.exists
|
||||
include_vars:
|
||||
ignore_unknown_extensions: true
|
||||
dir: "{{ app_config_root }}/vault"
|
||||
extensions:
|
||||
- yml
|
@ -1,17 +0,0 @@
|
||||
---
|
||||
- name: Check if internal system variables exists
|
||||
stat:
|
||||
path: "{{ plugin_config_root }}/vars.yml"
|
||||
register: vars_yml
|
||||
|
||||
- name: Load internal system variables
|
||||
no_log: true
|
||||
when: vars_yml.stat.exists
|
||||
include_vars:
|
||||
file: "{{ plugin_config_root }}/vars.yml"
|
||||
|
||||
- name: Export internal variable placeholders
|
||||
set_fact:
|
||||
dokku_mariadb_db_addr: "dokku-mariadb-{{ app }}"
|
||||
dokku_mariadb_db_user: "mariadb"
|
||||
dokku_hostname: "{{ lookup('file', '/home/dokku/HOSTNAME') }}"
|
@ -1,26 +0,0 @@
|
||||
---
|
||||
- name: Check if the app config file exists
|
||||
stat:
|
||||
path: "{{ app_config_root }}/config.yml"
|
||||
register: config_yml
|
||||
|
||||
- name: Load unencrypted variables
|
||||
no_log: true
|
||||
when: config_yml.stat.exists
|
||||
include_vars:
|
||||
file: "{{ app_config_root }}/config.yml"
|
||||
|
||||
- name: Check if a vault directory exists
|
||||
stat:
|
||||
path: "{{ app_config_root }}/vault"
|
||||
register: vault_dir
|
||||
|
||||
- name: Load encrypted variables
|
||||
no_log: true
|
||||
when: vault_dir.stat.exists
|
||||
include_vars:
|
||||
ignore_unknown_extensions: true
|
||||
dir: "{{ app_config_root }}/vault"
|
||||
extensions:
|
||||
- yml
|
||||
- yaml
|
@ -1,16 +0,0 @@
|
||||
---
|
||||
- hosts: all
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- include: ./lib/prepare.yml
|
||||
- include: ./lib/vars.yml
|
||||
- name: Remove deploy.d folder
|
||||
file:
|
||||
path: "{{ app_config_root }}"
|
||||
state: absent
|
||||
- name: Remove database(s)
|
||||
shell: "dokku {{ item.type }}:destroy {{ app }} --force"
|
||||
args:
|
||||
removes: "/var/lib/dokku/services/{{ item.type }}/{{ app }}"
|
||||
with_items: "{{ db }}"
|
||||
when: db is defined
|
7
plays/postdelete/lib/database.yml
Normal file
7
plays/postdelete/lib/database.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: Remove database(s)
|
||||
shell: "dokku {{ item.type }}:destroy {{ app }} --force"
|
||||
args:
|
||||
removes: "/var/lib/dokku/services/{{ item.type }}/{{ app }}"
|
||||
with_items: "{{ db }}"
|
||||
when: db is defined
|
5
plays/postdelete/lib/dirs.yml
Normal file
5
plays/postdelete/lib/dirs.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Remove application deploy.d folder
|
||||
file:
|
||||
path: "{{ app_config_root }}"
|
||||
state: absent
|
7
plays/postdelete/postdelete.yml
Normal file
7
plays/postdelete/postdelete.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
- hosts: all
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- include: ../commonlib/vars.yml
|
||||
- include: ./lib/dirs.yml
|
||||
- include: ./lib/database.yml
|
@ -2,8 +2,7 @@
|
||||
- hosts: all
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- include: ./lib/prepare.yml
|
||||
- include: ./lib/vars.yml
|
||||
- include: ../commonlib/vars.yml
|
||||
- include: ./lib/http.yml
|
||||
- include: ./lib/https.yml
|
||||
- include: ./lib/proxy.yml
|
@ -2,8 +2,7 @@
|
||||
- hosts: all
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- include: ./lib/prepare.yml
|
||||
- include: ./lib/vars.yml
|
||||
- include: ../commonlib/vars.yml
|
||||
- include: ./lib/domain.yml
|
||||
- include: ./lib/database.yml
|
||||
- include: ./lib/volumes.yml
|
Reference in New Issue
Block a user