---
- name: Check if docker is installed
  stat:
    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
  with_items: "{{ containers_to_rm }}"

---
- name: Check if docker is installed
  stat:
    path: /usr/bin/docker
  register: docker_path_stat

- name: remove "{{ containers_to_rm|join(', ') }}" containers
  docker_container:
    name: "{{ item }}"
    state: absent
  when:
    - container_cli == 'podman'
    - docker_path_stat.stat.exists
  with_items: "{{ containers_to_rm }}"

Simplify logic in docker detection for docker-rm role
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
