Merge "Ensure docker is running before dropping containers"
This commit is contained in:
commit
8c67a716bf
|
@ -4,6 +4,12 @@
|
|||
path: /usr/bin/docker
|
||||
register: docker_path_stat
|
||||
|
||||
- name: Ensure docker service is running
|
||||
when: docker_path_stat.stat.exists
|
||||
systemd:
|
||||
name: docker
|
||||
register: docker_service_state
|
||||
|
||||
- name: remove "{{ containers_to_rm|join(', ') }}" containers
|
||||
docker_container:
|
||||
name: "{{ item }}"
|
||||
|
@ -11,4 +17,5 @@
|
|||
when:
|
||||
- container_cli == 'podman'
|
||||
- docker_path_stat.stat.exists
|
||||
- docker_service_state.status['SubState'] == 'running'
|
||||
with_items: "{{ containers_to_rm }}"
|
||||
|
|
Loading…
Reference in New Issue