--- - hosts: all tasks: - name: Update the apt package index become: yes apt: name: "*" state: latest update_cache: yes force_apt_get: yes - name: Install packages for apt add repository over HTTPS become: yes apt: name: "{{ packagesdep }}" force_apt_get: yes state: latest update_cache: yes vars: packagesdep: - git - apt-transport-https - ca-certificates - wget - software-properties-common - gnupg2 - curl - name: Add Apt signing key from official docker repo apt_key: url: https://download.docker.com/linux/debian/gpg state: present - name: add docker official repository for Debian Stretch apt_repository: repo: deb [arch=amd64] https://download.docker.com/linux/debian stretch stable state: present - name: Index new repo into the cache become: yes apt: name: "*" state: latest update_cache: yes force_apt_get: yes - name: actually install docker apt: name: "docker-ce" state: latest - name: Ensure docker-compose is installed and available get_url: url: https://github.com/docker/compose/releases/download/1.22.0/docker-compose-{{ ansible_system }}-{{ ansible_userspace_architecture }} dest: /usr/local/bin/docker-compose mode: 'u+x,g+x'