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

28 lines
1.2 KiB
YAML
Raw Permalink Normal View History

---
- name: Clean up
hosts: all
gather_facts: true
tasks:
2023-04-30 13:07:53 +02:00
- 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"
2023-04-30 13:07:53 +02:00
register: "docker_compose_file"
2023-04-30 13:07:53 +02:00
- name: "{{ cookiecutter.app_name | upper }} | Remove docker-compose."
community.docker.docker_compose:
2023-04-30 13:07:53 +02:00
project_src: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_config_path | expanduser | realpath {% raw %}}}{% endraw %}/"
build: false
state: absent
2023-04-30 13:07:53 +02:00
when: "docker_compose_file.stat.exists"
become: false
2023-04-30 13:07:53 +02:00
- name: "{{ cookiecutter.app_name | upper }} | Remove the docker-compose file"
ansible.builtin.file:
2023-04-30 13:07:53 +02:00
path: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_config_path | expanduser | realpath {% raw %}}}{% endraw %}/docker-compose.yml"
state: "absent"
when: "docker_compose_file.stat.exists"