2023-01-09 15:25:45 +01:00
|
|
|
---
|
|
|
|
- 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."
|
2023-01-09 15:25:45 +01:00
|
|
|
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-01-09 15:25:45 +01:00
|
|
|
|
2023-04-30 13:07:53 +02:00
|
|
|
- name: "{{ cookiecutter.app_name | upper }} | Remove docker-compose."
|
2023-01-09 15:25:45 +01:00
|
|
|
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 %}/"
|
2023-01-09 15:25:45 +01:00
|
|
|
build: false
|
|
|
|
state: absent
|
2023-04-30 13:07:53 +02:00
|
|
|
when: "docker_compose_file.stat.exists"
|
2023-01-09 15:25:45 +01:00
|
|
|
become: false
|
|
|
|
|
2023-04-30 13:07:53 +02:00
|
|
|
- name: "{{ cookiecutter.app_name | upper }} | Remove the docker-compose file"
|
2023-01-09 15:25:45 +01:00
|
|
|
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"
|