diff --git a/plays/lib/database.yml b/plays/lib/database.yml index 62c352c..cd43295 100644 --- a/plays/lib/database.yml +++ b/plays/lib/database.yml @@ -1,12 +1,11 @@ --- +- name: Setup database facts + set_fact: + mount_map: + mariadb: /var/lib/mysql - name: Run database setup tasks block: - - name: Setup database facts - set_fact: - mount_map: - mariadb: /var/lib/mysql - - name: "Create {{ item.type }} database" no_log: true shell: " diff --git a/plays/post_delete.yml b/plays/post_delete.yml index 3b5d4c2..1a2e045 100644 --- a/plays/post_delete.yml +++ b/plays/post_delete.yml @@ -1,4 +1,14 @@ --- - hosts: all gather_facts: false - tasks: [] + tasks: + - 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 }}" diff --git a/plays/pre_deploy.yml b/plays/pre_deploy.yml index 17bf91e..ad794bd 100644 --- a/plays/pre_deploy.yml +++ b/plays/pre_deploy.yml @@ -16,7 +16,12 @@ - name: Include domain tasks include: ./lib/domain.yml + # Note(decentral1se): in order to iterate through the end-user defined `db` + # stanza in the config.yml, we need to pass them into the include / block + # using `with_items` because Ansible decides that is the only way we can do + # that - name: Include database tasks + no_log: true include: ./lib/database.yml with_items: "{{ db }}" when: db is defined