2022-11-19 10:10:57 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
- 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" }
|
2022-11-19 10:54:31 +01:00
|
|
|
when: docker_command == 'docker'
|
2022-11-19 10:10:57 +01:00
|
|
|
|
|
|
|
- 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" }
|
2022-11-19 10:54:31 +01:00
|
|
|
when: docker_command == 'docker'
|
2022-11-19 10:10:57 +01:00
|
|
|
|
|
|
|
- name: Run apt update
|
|
|
|
apt:
|
|
|
|
update_cache: true
|
|
|
|
cache_valid_time: 3600
|
|
|
|
become: true
|
2022-11-19 10:54:31 +01:00
|
|
|
when: docker_command == 'docker'
|
2022-11-19 11:44:57 +01:00
|
|
|
|
|
|
|
- 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'
|
2022-11-19 11:46:52 +01:00
|
|
|
- ansible_distribution_version|int < 20.10
|
2022-11-19 11:44:57 +01:00
|
|
|
|
|
|
|
- name: Add Kubic (Podman) repository
|
|
|
|
apt_repository:
|
|
|
|
repo: "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg] https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_{{ ansible_distribution_version }}/ /"
|
|
|
|
filename: kubic-podman
|
|
|
|
when:
|
|
|
|
- docker_command == 'podman'
|
2022-11-19 11:46:52 +01:00
|
|
|
- ansible_distribution_version|int < 20.10
|