--- - block: - name: Add Docker CE repository yum_repository: name: "docker-ce" file: "Docker-CE" description: "Docker CE Stable" baseurl: "https://download.docker.com/linux/centos/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/stable" gpgcheck: yes enabled: yes gpgkey: "https://download.docker.com/linux/rhel/gpg" - name: Install dependencies package: name: "{{ item }}" state: present loop: "{{ dockerengine_packages_extra }}" - name: Install python dependencies pip: name: "{{ item }}" virtualenv: /opt/python2/ansible-deps loop: "{{ docker_ansible_deps }}" - name: Add docker-compose wrapper template: src: bin/docker-compose.j2 dest: /usr/local/bin/docker-compose owner: root group: root mode: 0755 - name: Ensure to remove old docker packages package: name: - docker - docker-common - docker-engine state: absent - name: Install packages package: name: "{{ item }}" state: present loop: "{{ dockerengine_packages }}" become: True become_user: root