--- - name: Ensure Docker repository is removed yum_repository: name: docker-ce description: Docker CE Repository baseurl: https://download.docker.com/linux/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/$basearch/stable gpgkey: https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg enabled: true gpgcheck: true state: absent when: ansible_distribution | lower not in ['amazon'] - name: Ensure Docker repository is removed command: yum-config-manager disable docker-ce when: ansible_distribution | lower not in ['amazon'] - name: Ensure Docker prerequisites are uninstalled yum: name: - yum-utils - device-mapper-persistent-data - lvm2 state: absent register: ensure_docker_prerequisites_uninstalled until: ensure_docker_prerequisites_uninstalled is succeeded retries: 3 delay: 10 - name: Ensure python-dnf is uninstalled package: name: "{{ 'python-dnf' if ansible_python_version is version_compare('3.0.0', '<') else 'python3-dnf' }}" state: absent register: ensure_python_dnf_installed until: ensure_python_dnf_installed is succeeded retries: 3 delay: 10 when: ansible_pkg_mgr == 'dnf'