--- - name: Install required packages for HTTPS repositories apt: name={{ item.package }} state=present update_cache=yes cache_valid_time=3600 become: true with_items: - { package: apt-transport-https } - { package: ca-certificates } - name: Add Docker repository for Ubuntu apt_key: id={{ item.id }} url={{ item.url }} state=present become: true with_items: - { id: "9DC858229FC7DD38854AE2D88D81803C0EBFCD88", url: "https://download.docker.com/linux/ubuntu/gpg" } when: docker_command == 'docker' - name: Install Docker repository apt_repository: repo={{ item.repo }} state=present become: true with_items: - { repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable" } when: docker_command == 'docker' - name: Ensure keyring folder for apt exists file: path: /etc/apt/keyrings state: directory - name: Get Kubic (Podman) repo key shell: "curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_{{ ansible_distribution_version }}/Release.key | gpg --dearmor | tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null" when: - docker_command == 'podman' - ansible_distribution_version|int < 20.10 - name: Add Kubic (Podman) repository apt_repository: repo: "deb [signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg] https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_{{ ansible_distribution_version }}/ /" filename: kubic-podman when: - docker_command == 'podman' - ansible_distribution_version|int < 20.10 - name: Run apt update apt: update_cache: true cache_valid_time: 3600 become: true