Group plays to hooks

This commit is contained in:
Luke Murphy 2020-04-14 11:30:40 +02:00
parent 0079925738
commit c099827d88
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
16 changed files with 63 additions and 63 deletions

42
plays/commonlib/vars.yml Normal file
View 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

View File

@ -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') }}"

View File

@ -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

View File

@ -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

View 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

View File

@ -0,0 +1,5 @@
---
- name: Remove application deploy.d folder
file:
path: "{{ app_config_root }}"
state: absent

View File

@ -0,0 +1,7 @@
---
- hosts: all
gather_facts: false
tasks:
- include: ../commonlib/vars.yml
- include: ./lib/dirs.yml
- include: ./lib/database.yml

View File

@ -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

View File

@ -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