2017-02-22 00:58:24 +08:00
|
|
|
---
|
2019-04-16 21:33:02 +08:00
|
|
|
- name: uninstall old docker versions
|
|
|
|
package:
|
|
|
|
name: ['docker', 'docker-engine', 'docker.io', 'containerd', 'runc']
|
|
|
|
state: absent
|
2019-05-18 05:10:34 +08:00
|
|
|
when: container_package_name == 'docker-ce'
|
2019-04-16 21:33:02 +08:00
|
|
|
|
2017-02-22 00:58:24 +08:00
|
|
|
- name: allow apt to use a repository over https (debian)
|
|
|
|
package:
|
2019-05-21 21:21:16 +08:00
|
|
|
name: ['apt-transport-https', 'ca-certificates', 'gnupg', 'software-properties-common']
|
2017-02-22 00:58:24 +08:00
|
|
|
update_cache: yes
|
2018-12-19 21:55:01 +08:00
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
2017-02-22 00:58:24 +08:00
|
|
|
|
|
|
|
- name: add docker's gpg key
|
|
|
|
apt_key:
|
2021-03-03 22:43:50 +08:00
|
|
|
url: "https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }}/gpg"
|
2018-12-20 17:00:26 +08:00
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
2019-05-18 05:10:34 +08:00
|
|
|
when: container_package_name == 'docker-ce'
|
2017-02-22 00:58:24 +08:00
|
|
|
|
2019-04-16 21:33:02 +08:00
|
|
|
- name: add docker repository
|
2017-02-22 00:58:24 +08:00
|
|
|
apt_repository:
|
2021-03-03 22:43:50 +08:00
|
|
|
repo: "deb https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['distribution_release'] }} stable"
|
2019-05-18 05:10:34 +08:00
|
|
|
when: container_package_name == 'docker-ce'
|
|
|
|
|
|
|
|
- name: add podman ppa repository
|
|
|
|
apt_repository:
|
|
|
|
repo: "ppa:projectatomic/ppa"
|
|
|
|
when:
|
|
|
|
- container_package_name == 'podman'
|
2021-03-03 22:43:50 +08:00
|
|
|
- ansible_facts['distribution'] == 'Ubuntu'
|