1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/docker_swarm/tasks/cleanup.yml
Ansible Core Team aebc1b03fd Initial commit
2020-03-09 09:11:07 +00:00

35 lines
819 B
YAML

- name: CLEANUP | Leave Docker Swarm
docker_swarm:
state: absent
force: true
ignore_errors: yes
register: leave_swarm
- name: CLEANUP | Kill Docker and cleanup
when: leave_swarm is failed
block:
- name: CLEANUP | Kill docker daemon
command: systemctl kill -s 9 docker
become: yes
- name: CLEANUP | Clear out /var/lib/docker
shell: rm -rf /var/lib/docker/*
args:
warn: no
- name: CLEANUP | Start docker daemon
service:
name: docker
state: started
become: yes
- name: CLEANUP | Wait for docker daemon to be fully started
command: docker ps
register: result
until: result is success
retries: 10
- name: CLEANUP | Leave Docker Swarm
docker_swarm:
state: absent
force: true