mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
819 B
YAML
36 lines
819 B
YAML
5 years ago
|
- 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
|