2023-04-28 00:32:36 +02:00
|
|
|
---
|
2023-04-29 20:48:33 +02:00
|
|
|
- name: "Clean up"
|
|
|
|
hosts: "all"
|
2023-04-28 00:32:36 +02:00
|
|
|
gather_facts: true
|
|
|
|
tasks:
|
2023-04-29 20:48:33 +02:00
|
|
|
- name: "Load the defaults"
|
2023-04-28 00:32:36 +02:00
|
|
|
ansible.builtin.include_vars:
|
|
|
|
dir: "../../defaults"
|
|
|
|
|
2023-04-29 20:48:33 +02:00
|
|
|
- name: "Check if the docker-compose file exists."
|
2023-04-28 00:32:36 +02:00
|
|
|
ansible.builtin.stat:
|
2023-04-29 20:48:33 +02:00
|
|
|
path: "{{ sonarqube_config_path | expanduser | realpath }}/docker-compose.yml"
|
|
|
|
register: "docker_compose_file"
|
2023-04-28 00:32:36 +02:00
|
|
|
|
2023-04-29 20:48:33 +02:00
|
|
|
- name: "Remove docker-compose."
|
2023-04-28 00:32:36 +02:00
|
|
|
community.docker.docker_compose:
|
2023-04-29 20:48:33 +02:00
|
|
|
project_src: "{{ sonarqube_config_path | expanduser | realpath }}/"
|
2023-04-28 00:32:36 +02:00
|
|
|
build: false
|
2023-04-29 20:48:33 +02:00
|
|
|
state: "absent"
|
|
|
|
when: "docker_compose_file.stat.exists"
|
2023-04-28 00:32:36 +02:00
|
|
|
become: false
|
|
|
|
|
2023-04-29 20:48:33 +02:00
|
|
|
- name: "Remove the docker-compose file"
|
2023-04-28 00:32:36 +02:00
|
|
|
ansible.builtin.file:
|
2023-04-29 20:48:33 +02:00
|
|
|
path: "{{ sonarqube_config_path | expanduser | realpath }}/docker-compose.yml"
|
|
|
|
state: "absent"
|
|
|
|
when: "docker_compose_file.stat.exists"
|