cookiecutter-ansible-role-d.../ansible-role-{{cookiecutter.app_name}}/molecule/default/cleanup.yml

28 lines
1.2 KiB
YAML

---
- name: Clean up
hosts: all
gather_facts: true
tasks:
- name: "{{ cookiecutter.app_name | upper }} | Load the defaults."
ansible.builtin.include_vars:
dir: "../../defaults"
- name: "{{ cookiecutter.app_name | upper }} | Check if the docker-compose file exists."
ansible.builtin.stat:
path: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_config_path | expanduser | realpath {% raw %}}}{% endraw %}/docker-compose.yml"
register: "docker_compose_file"
- name: "{{ cookiecutter.app_name | upper }} | Remove docker-compose."
community.docker.docker_compose:
project_src: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_config_path | expanduser | realpath {% raw %}}}{% endraw %}/"
build: false
state: absent
when: "docker_compose_file.stat.exists"
become: false
- name: "{{ cookiecutter.app_name | upper }} | Remove the docker-compose file"
ansible.builtin.file:
path: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_config_path | expanduser | realpath {% raw %}}}{% endraw %}/docker-compose.yml"
state: "absent"
when: "docker_compose_file.stat.exists"