infrastructure/ansible/plays/undeploy.yaml

21 lines
624 B
YAML
Raw Normal View History

2024-01-22 17:04:08 +01:00
- name: Undeploy service
block:
- name: Set service_dir
ansible.builtin.set_fact:
service_dir: "/home/core/compose/{{ item | mandatory }}"
- name: Check if service is present
stat:
path: "{{ service_dir | mandatory }}"
register: dir
- name: Stop Service
community.docker.docker_compose:
project_src: "{{ service_dir | mandatory }}"
state: absent
remove_orphans: true
when: dir.stat.exists == True
- name: Remove Service
file:
state: absent
path: "{{ service_dir | mandatory }}"
when: dir.stat.exists == True