cleanup: removed centos code, cleaned up debian & ubuntu references

This commit is contained in:
Radar231 2022-01-03 10:08:35 -05:00
parent 08b8b12a56
commit 488a67187d
2 changed files with 5 additions and 51 deletions

View File

@ -4,12 +4,11 @@
This role will install docker on the target host. This role will install docker on the target host.
This role should work on both Ubuntu and CentOS based hosts.
NOTE: NOTE:
The following variables must be specified in the calling playbook (usually The following variable(s) must be specified in the calling playbook (usually
done by doing a 'gather_facts' action); done by doing a 'gather_facts' action);
{{ ansible_distribution }} {{ ansible_distribution }}
{{ ansible_os_family }}

View File

@ -4,13 +4,13 @@
# This role is based on the steps presented at; # This role is based on the steps presented at;
# - https://docs.docker.com/engine/install/ubuntu/ # - https://docs.docker.com/engine/install/ubuntu/
# - https://docs.docker.com/engine/install/debian/ # - https://docs.docker.com/engine/install/debian/
# - https://docs.docker.com/engine/install/centos/ # - https://wiki.alpinelinux.org/wiki/Docker
# #
########################################################################### ###########################################################################
# tasks file for docker # tasks file for docker
############################################################ ############################################################
- name: Ensure old docker packages are removed (Ubuntu/Debian) - name: Ensure old docker packages are removed (Debian based repos)
apt: apt:
name: name:
- docker - docker
@ -21,23 +21,6 @@
state: absent state: absent
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
############################################################
- name: Ensure old docker packages are removed (CentOS)
yum:
name:
- docker-client
- docker-client-latest
- docker-common
- docker-latest
- docker-latest-logrotate
- docker-logrotate
- docker-engine
- podman
- runc
- buildah
state: absent
when: ansible_distribution == "CentOS"
############################################################ ############################################################
- name: Ensure required supporting packages are installed (Ubuntu) - name: Ensure required supporting packages are installed (Ubuntu)
apt: apt:
@ -61,14 +44,6 @@
state: present state: present
when: ansible_distribution == "Debian" when: ansible_distribution == "Debian"
############################################################
- name: Ensure required supporting packages are installed (CentOS)
yum:
name:
- yum-utils
state: present
when: ansible_distribution == "CentOS"
############################################################ ############################################################
- name: Retrieve docker's official GPG key (Ubuntu) - name: Retrieve docker's official GPG key (Ubuntu)
shell: shell:
@ -112,15 +87,6 @@
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
when: ansible_distribution == "Debian" when: ansible_distribution == "Debian"
############################################################
- name: Add the stable docker repository (CentOS)
shell:
cmd: >
/usr/bin/yum-config-manager
--add-repo
https://download.docker.com/linux/centos/docker-ce.repo
when: ansible_distribution == "CentOS"
############################################################ ############################################################
- name: Update package cache (Ubuntu/Debian) - name: Update package cache (Ubuntu/Debian)
apt: apt:
@ -137,16 +103,6 @@
state: present state: present
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
############################################################
- name: Install docker packages (CentOS)
yum:
name:
- docker-ce
- docker-ce-cli
- containerd.io
state: present
when: ansible_distribution == "CentOS"
############################################################ ############################################################
- name: Add user to docker group - name: Add user to docker group
user: user:
@ -163,8 +119,7 @@
############################################################ ############################################################
# using the pip3 command rather than the pip ansible module # using the pip3 command rather than the pip ansible module
# because ansible can get in a weird state depending on the # because ansible can get in a weird state depending on the
# python version used on the target host (python 2 on CentOS 7 # python version used on the target host
# vs python 3 otherwise)
- name: Install docker python package - name: Install docker python package
shell: shell:
cmd: pip3 install docker cmd: pip3 install docker