--- - name: uninstall old docker versions package: name: ['docker', 'docker-engine', 'docker.io', 'containerd', 'runc'] state: absent when: container_package_name == 'docker-ce' - name: allow apt to use a repository over https (debian) package: name: ['apt-transport-https', 'ca-certificates', 'gnupg', 'software-properties-common'] update_cache: yes register: result until: result is succeeded - name: add docker's gpg key apt_key: url: 'https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg' register: result until: result is succeeded when: container_package_name == 'docker-ce' - name: add docker repository apt_repository: repo: "deb https://download.docker.com/linux/{{ ansible_distribution | lower}} {{ ansible_distribution_release }} stable" when: container_package_name == 'docker-ce' - name: add podman ppa repository apt_repository: repo: "ppa:projectatomic/ppa" when: - container_package_name == 'podman' - ansible_distribution == 'Ubuntu'