ensure-docker: workaround for centos-8 conflicts

- assured configured repository is based on original repository definition
- workaround for bypassing rpm installation conflicts
  on CentOS/RHEL-8.
- we no longer need special dnf command for installation.

Change-Id: I0b2ccd788f8010b864c45140189dcb215e7c82fb
This commit is contained in:
Sorin Sbarnea 2020-01-17 10:48:39 +00:00
parent a7deb384f9
commit 9f222677e2
3 changed files with 16 additions and 13 deletions

View File

@ -18,6 +18,18 @@
repositories_keys: "{{ _docker_keys }}"
repositories_list: "{{ _docker_repos }}"
# Workaround for docker-ce installation failure due conflict with containerd.io
# https://bugzilla.redhat.com/show_bug.cgi?id=1756473#c1
- name: Patch docker-ce.repo for newer RedHat distros
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == '8'
ini_file:
path: /etc/yum.repos.d/docker-ce.repo
section: docker-ce-stable
option: module_hotfixes
value: "True"
no_extra_spaces: true
create: false
- name: Install pre-reqs
package:
name: "{{ _docker_upstream_distro_required_packages }}"
@ -29,23 +41,10 @@
state: absent
when: docker_upstream_distro_remove_packages
# package/dnf module do not support `--nobest` option which is needed for
# installing docker-ce on centos-8
- name: Install upstream docker using package
when: not (ansible_os_family == 'RedHat' and ansible_distribution_major_version == '8')
package:
name: "{{ docker_upstream_distro_packages }}"
state: present
notify: Restart docker
- name: Install upstream docker using shell
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == '8'
shell:
cmd: |
dnf install --nobest -y {{ docker_upstream_distro_packages | join(' ') }}
warn: false
register: result
changed_when: "'Complete!' in result.stdout"
notify: Restart docker
- include_tasks: docker-setup.yaml

View File

@ -33,7 +33,10 @@ _docker_keys:
_docker_repos:
# TODO(mordred) We should add a proxy cache mirror for this
# Keep 'name' (section) and 'file' in sync with https://download.docker.com/linux/centos/docker-ce.repo
# to avoid breaking tools that assume standard repository install.
- name: docker-ce-stable
file: docker-ce
description: Docker CE Stable - $basearch
baseurl: "{{ docker_mirror_base_url }}/7/$basearch/stable"
gpgcheck: yes

View File

@ -32,6 +32,7 @@
- name: Add repositories
yum_repository:
name: "{{ zj_item['name'] }}"
file: "{{ zj_item['file'] | default(zj_item['name']) }}"
description: "{{ zj_item['description'] | default(omit) }}"
baseurl: "{{ zj_item['baseurl'] | default(omit) }}"
gpgcheck: "{{ zj_item['gpgcheck'] | default(omit) }}"