Disable docker-ce yum repo by default / cleanups (#7080)

Upgrading docker / containerd without adapting the configuration might break the node,
so disable docker-ce repo by default.
We are already using dpkg hold for Debian.

All containerd.io packages provide /usr/bin/runc, so no need to check

yum_conf was never used for containerd

module_hotfixes should not be needed with the EL8 repo

Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
This commit is contained in:
Etienne Champetier 2020-12-23 16:12:26 -05:00 committed by GitHub
parent c971debd15
commit 1945499e2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 12 additions and 58 deletions

View file

@ -14,7 +14,7 @@ containerd_config:
containerd_cfg_dir: /etc/containerd containerd_cfg_dir: /etc/containerd
# Path to runc binary # Path to runc binary
runc_binary: /usr/sbin/runc runc_binary: /usr/bin/runc
yum_repo_dir: /etc/yum.repos.d yum_repo_dir: /etc/yum.repos.d

View file

@ -65,18 +65,3 @@
when: when:
- ansible_distribution in ["CentOS","RedHat"] - ansible_distribution in ["CentOS","RedHat"]
- yum_result.results | length == 0 - yum_result.results | length == 0
- name: Copy yum.conf for editing
copy:
src: "{{ yum_conf }}"
dest: "{{ containerd_yum_conf }}"
remote_src: yes
when: ansible_distribution in ["CentOS","RedHat"]
- name: Edit copy of yum.conf to set obsoletes=0
lineinfile:
path: "{{ containerd_yum_conf }}"
state: present
regexp: '^obsoletes='
line: 'obsoletes=0'
when: ansible_distribution in ["CentOS","RedHat"]

View file

@ -95,9 +95,9 @@
args: args:
pkg: "{{ item.name }}" pkg: "{{ item.name }}"
force: "{{ item.force | default(omit) }}" force: "{{ item.force | default(omit) }}"
conf_file: "{{ item.yum_conf | default(omit) }}"
state: present state: present
update_cache: "{{ omit if ansible_distribution == 'Fedora' else True }}" update_cache: "{{ omit if ansible_distribution == 'Fedora' else True }}"
enablerepo: "{{ item.repo | default(omit) }}"
register: containerd_task_result register: containerd_task_result
until: containerd_task_result is succeeded until: containerd_task_result is succeeded
retries: 4 retries: 4
@ -109,26 +109,6 @@
- containerd_package_info.pkgs|length > 0 - containerd_package_info.pkgs|length > 0
ignore_errors: true ignore_errors: true
- name: Check if runc is installed
stat:
path: "{{ runc_binary }}"
register: runc_stat
- name: Install runc package if necessary
action: "{{ containerd_package_info.pkg_mgr }}"
args:
pkg: runc
state: present
update_cache: "{{ omit if ansible_distribution == 'Fedora' else True }}"
register: runc_task_result
until: runc_task_result is succeeded
retries: 4
delay: "{{ retry_stagger | d(3) }}"
notify: restart containerd
when:
- not is_ostree
- not runc_stat.stat.exists
- name: Ensure latest version of libseccomp installed # noqa 403 - name: Ensure latest version of libseccomp installed # noqa 403
package: package:
name: libseccomp name: libseccomp

View file

@ -1,7 +1,7 @@
[docker-ce] [docker-ce]
name=Docker-CE Repository name=Docker-CE Repository
baseurl={{ containerd_fedora_repo_base_url }} baseurl={{ containerd_fedora_repo_base_url }}
enabled=1 enabled=0
gpgcheck={{ '1' if containerd_fedora_repo_gpgkey else '0' }} gpgcheck={{ '1' if containerd_fedora_repo_gpgkey else '0' }}
gpgkey={{ containerd_fedora_repo_gpgkey }} gpgkey={{ containerd_fedora_repo_gpgkey }}
{% if http_proxy is defined %}proxy={{ http_proxy }}{% endif %} {% if http_proxy is defined %}proxy={{ http_proxy }}{% endif %}

View file

@ -1,13 +1,10 @@
[docker-ce] [docker-ce]
name=Docker-CE Repository name=Docker-CE Repository
baseurl={{ docker_rh_repo_base_url }} baseurl={{ docker_rh_repo_base_url }}
enabled=1 enabled=0
gpgcheck={{ '1' if docker_rh_repo_gpgkey else '0' }} gpgcheck={{ '1' if docker_rh_repo_gpgkey else '0' }}
keepcache={{ docker_rpm_keepcache | default('1') }} keepcache={{ docker_rpm_keepcache | default('1') }}
gpgkey={{ docker_rh_repo_gpgkey }} gpgkey={{ docker_rh_repo_gpgkey }}
{% if http_proxy is defined %} {% if http_proxy is defined %}
proxy={{ http_proxy }} proxy={{ http_proxy }}
{% endif %} {% endif %}
{% if ansible_os_family == "RedHat" and ansible_distribution_major_version|int == 8 %}
module_hotfixes=True
{% endif %}

View file

@ -18,5 +18,3 @@ containerd_repo_info:
deb {{ containerd_debian_repo_base_url }} deb {{ containerd_debian_repo_base_url }}
{{ ansible_distribution_release|lower }} {{ ansible_distribution_release|lower }}
{{ containerd_debian_repo_component }} {{ containerd_debian_repo_component }}
runc_binary: /usr/bin/runc

View file

@ -3,5 +3,3 @@ containerd_package_info:
pkg_mgr: dnf pkg_mgr: dnf
pkgs: pkgs:
- name: "{{ containerd_versioned_pkg[containerd_version | string] }}" - name: "{{ containerd_versioned_pkg[containerd_version | string] }}"
runc_binary: /usr/bin/runc

View file

@ -3,10 +3,7 @@ containerd_package_info:
pkg_mgr: yum pkg_mgr: yum
pkgs: pkgs:
- name: "{{ containerd_versioned_pkg[containerd_version | string] }}" - name: "{{ containerd_versioned_pkg[containerd_version | string] }}"
repo: "docker-ce"
containerd_pkgs:
- name: "{{ containerd_versioned_pkg[containerd_version | string] }}"
yum_conf: "{{ containerd_yum_conf }}"
containerd_repo_key_info: containerd_repo_key_info:
pkg_key: '' pkg_key: ''
@ -15,5 +12,3 @@ containerd_repo_key_info:
containerd_repo_info: containerd_repo_info:
pkg_repo: '' pkg_repo: ''
repos: [] repos: []
runc_binary: /bin/runc

View file

@ -18,5 +18,3 @@ containerd_repo_info:
deb {{ containerd_ubuntu_repo_base_url }} deb {{ containerd_ubuntu_repo_base_url }}
{{ ansible_distribution_release|lower }} {{ ansible_distribution_release|lower }}
{{ containerd_ubuntu_repo_component }} {{ containerd_ubuntu_repo_component }}
runc_binary: /usr/bin/runc

View file

@ -166,6 +166,7 @@
conf_file: "{{ item.yum_conf|default(omit) }}" conf_file: "{{ item.yum_conf|default(omit) }}"
state: "{{ item.state | default('present') }}" state: "{{ item.state | default('present') }}"
update_cache: "{{ omit if ansible_distribution == 'Fedora' else True }}" update_cache: "{{ omit if ansible_distribution == 'Fedora' else True }}"
enablerepo: "{{ item.repo | default(omit) }}"
register: docker_task_result register: docker_task_result
until: docker_task_result is succeeded until: docker_task_result is succeeded
retries: 4 retries: 4

View file

@ -1,13 +1,10 @@
[docker-ce] [docker-ce]
name=Docker-CE Repository name=Docker-CE Repository
baseurl={{ docker_rh_repo_base_url }} baseurl={{ docker_rh_repo_base_url }}
enabled=1 enabled=0
gpgcheck={{ '1' if docker_rh_repo_gpgkey else '0' }} gpgcheck={{ '1' if docker_rh_repo_gpgkey else '0' }}
keepcache={{ docker_rpm_keepcache | default('1') }} keepcache={{ docker_rpm_keepcache | default('1') }}
gpgkey={{ docker_rh_repo_gpgkey }} gpgkey={{ docker_rh_repo_gpgkey }}
{% if http_proxy is defined %} {% if http_proxy is defined %}
proxy={{ http_proxy }} proxy={{ http_proxy }}
{% endif %} {% endif %}
{% if ansible_os_family == "RedHat" and ansible_distribution_major_version|int == 8 %}
module_hotfixes=True
{% endif %}

View file

@ -30,16 +30,21 @@ docker_selinux_versioned_pkg:
docker_pkgs_use_docker_ce: docker_pkgs_use_docker_ce:
- name: "{{ docker_selinux_versioned_pkg[docker_selinux_version | string] }}" - name: "{{ docker_selinux_versioned_pkg[docker_selinux_version | string] }}"
yum_conf: "{{ docker_yum_conf }}" yum_conf: "{{ docker_yum_conf }}"
repo: "docker-ce"
- name: "{{ docker_versioned_pkg[docker_version | string] }}" - name: "{{ docker_versioned_pkg[docker_version | string] }}"
yum_conf: "{{ docker_yum_conf }}" yum_conf: "{{ docker_yum_conf }}"
repo: "docker-ce"
docker_pkgs: docker_pkgs:
- name: "{{ containerd_versioned_pkg[containerd_version | string] }}" - name: "{{ containerd_versioned_pkg[containerd_version | string] }}"
yum_conf: "{{ docker_yum_conf }}" yum_conf: "{{ docker_yum_conf }}"
repo: "docker-ce"
- name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}" - name: "{{ docker_cli_versioned_pkg[docker_cli_version | string] }}"
yum_conf: "{{ docker_yum_conf }}" yum_conf: "{{ docker_yum_conf }}"
repo: "docker-ce"
- name: "{{ docker_versioned_pkg[docker_version | string] }}" - name: "{{ docker_versioned_pkg[docker_version | string] }}"
yum_conf: "{{ docker_yum_conf }}" yum_conf: "{{ docker_yum_conf }}"
repo: "docker-ce"
docker_package_info: docker_package_info:
pkg_mgr: yum pkg_mgr: yum