changed from ansible_distribution to ansible_os_family
This commit is contained in:
parent
4b6960dbf7
commit
08b8b12a56
|
@ -3,13 +3,14 @@
|
|||
#
|
||||
# This role is based on the steps presented at;
|
||||
# - https://docs.docker.com/engine/install/ubuntu/
|
||||
# - https://docs.docker.com/engine/install/debian/
|
||||
# - https://docs.docker.com/engine/install/centos/
|
||||
#
|
||||
###########################################################################
|
||||
# tasks file for docker
|
||||
|
||||
############################################################
|
||||
- name: Ensure old docker packages are removed (Ubuntu)
|
||||
- name: Ensure old docker packages are removed (Ubuntu/Debian)
|
||||
apt:
|
||||
name:
|
||||
- docker
|
||||
|
@ -18,7 +19,7 @@
|
|||
- containerd
|
||||
- runc
|
||||
state: absent
|
||||
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS" or ansible_distribution == "Linux Mint"
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
############################################################
|
||||
- name: Ensure old docker packages are removed (CentOS)
|
||||
|
@ -49,6 +50,17 @@
|
|||
state: present
|
||||
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS" or ansible_distribution == "Linux Mint"
|
||||
|
||||
############################################################
|
||||
- name: Ensure required supporting packages are installed (Debian)
|
||||
apt:
|
||||
name:
|
||||
- ca-certificates
|
||||
- curl
|
||||
- gnupg
|
||||
- lsb-release
|
||||
state: present
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
############################################################
|
||||
- name: Ensure required supporting packages are installed (CentOS)
|
||||
yum:
|
||||
|
@ -66,6 +78,22 @@
|
|||
| /usr/bin/apt-key add -
|
||||
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS" or ansible_distribution == "Linux Mint"
|
||||
|
||||
############################################################
|
||||
- name: Remove keyring file (if exists) (Debian)
|
||||
file:
|
||||
path: /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
state: absent
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
############################################################
|
||||
- name: Retrieve docker's official GPG key (Debian)
|
||||
shell:
|
||||
cmd: >
|
||||
/usr/bin/curl -fsSL
|
||||
https://download.docker.com/linux/debian/gpg
|
||||
| gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
############################################################
|
||||
- name: Add the stable docker repository (Ubuntu)
|
||||
shell:
|
||||
|
@ -76,6 +104,14 @@
|
|||
stable"
|
||||
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS" or ansible_distribution == "Linux Mint"
|
||||
|
||||
############################################################
|
||||
- name: Add the stable docker repository (Debian)
|
||||
shell:
|
||||
cmd: >
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
|
||||
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
############################################################
|
||||
- name: Add the stable docker repository (CentOS)
|
||||
shell:
|
||||
|
@ -86,20 +122,20 @@
|
|||
when: ansible_distribution == "CentOS"
|
||||
|
||||
############################################################
|
||||
- name: Update package cache (Ubuntu)
|
||||
- name: Update package cache (Ubuntu/Debian)
|
||||
apt:
|
||||
update-cache: true
|
||||
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS" or ansible_distribution == "Linux Mint"
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
############################################################
|
||||
- name: Install docker packages (Ubuntu)
|
||||
- name: Install docker packages (Ubuntu/Debian)
|
||||
apt:
|
||||
name:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
state: present
|
||||
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS" or ansible_distribution == "Linux Mint"
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
############################################################
|
||||
- name: Install docker packages (CentOS)
|
||||
|
|
Loading…
Reference in New Issue