--- - block: - name: Add the Docker repository to EL get_url: url='{{ docker_el_repo }}' dest=/etc/yum.repos.d/docker-ce.repo - name: Install Docker yum: pkg={{ docker_el_packages }} state={{ docker_pkg_status }} when: docker_install | bool tags: docker - block: - name: Ensure that the service is stopped and disabled service: name=docker state=stopped enabled=no ignore_errors: True - name: Remove the Docker package yum: pkg={{ docker_el_packages }} state=absent - name: Remove the Docker repository file: dest=/etc/yum.repos.d/docker-ce.repo state=absent when: not docker_install | bool tags: docker