--- - name: Ensure Docker prerequisites are installed apt: name: - apt-transport-https - ca-certificates - curl - "{{ 'gnupg2' if ansible_distribution == 'Debian' else 'gnupg-agent' }}" - software-properties-common state: present register: ensure_docker_prerequisites_installed until: ensure_docker_prerequisites_installed is succeeded retries: 3 delay: 10 - name: Ensure Docker APT key is present apt_key: url: https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg state: present - name: Ensure Docker repository is installed and configured apt_repository: filename: docker-ce repo: "deb https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable" update_cache: true