Simplify logic in docker detection for docker-rm role

Fix and simplify the logic that detects if Docker is installed on the
host.

Change-Id: I641f7546afeabf222bcbe148fbe6cc94547f5c92
This commit is contained in:
Emilien Macchi 2018-11-17 17:09:30 -05:00
parent 92fab489a3
commit 51e1f34b1c

View File

@ -4,14 +4,11 @@
path: /usr/bin/docker
register: docker_path_stat
- set_fact:
docker_installed: "{{ docker_path_stat.results | map(attribute='stat') | map(attribute='exists') is any }}"
- name: remove "{{ containers_to_rm|join(', ') }}" containers
docker_container:
name: "{{ item }}"
state: absent
when:
- container_cli == 'podman'
- docker_installed
- docker_path_stat.stat.exists
with_items: "{{ containers_to_rm }}"