diff --git a/README.md b/README.md index 5d6a26f..c5e4592 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,11 @@ This role will install docker on the target host. -This role should work on both Ubuntu and CentOS based hosts. - 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); {{ ansible_distribution }} +{{ ansible_os_family }} diff --git a/tasks/main.yml b/tasks/main.yml index 3951517..5b1429f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,13 +4,13 @@ # 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/ +# - https://wiki.alpinelinux.org/wiki/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: name: - docker @@ -21,23 +21,6 @@ state: absent 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) apt: @@ -61,14 +44,6 @@ state: present 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) shell: @@ -112,15 +87,6 @@ | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 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) apt: @@ -137,16 +103,6 @@ state: present 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 user: @@ -163,8 +119,7 @@ ############################################################ # using the pip3 command rather than the pip ansible module # because ansible can get in a weird state depending on the -# python version used on the target host (python 2 on CentOS 7 -# vs python 3 otherwise) +# python version used on the target host - name: Install docker python package shell: cmd: pip3 install docker