2019-07-11 06:46:54 +00:00
|
|
|
---
|
|
|
|
- name: ensure containerd repository public key is installed
|
2021-01-08 21:24:55 +00:00
|
|
|
apt_key:
|
2019-07-11 06:46:54 +00:00
|
|
|
id: "{{ item }}"
|
|
|
|
url: "{{ containerd_repo_key_info.url }}"
|
|
|
|
state: present
|
|
|
|
register: keyserver_task_result
|
|
|
|
until: keyserver_task_result is succeeded
|
|
|
|
retries: 4
|
|
|
|
delay: "{{ retry_stagger | d(3) }}"
|
|
|
|
with_items: "{{ containerd_repo_key_info.repo_keys }}"
|
2021-01-11 15:21:08 +00:00
|
|
|
environment: "{{ proxy_env }}"
|
2021-01-08 21:24:55 +00:00
|
|
|
when: ansible_pkg_mgr == 'apt'
|
2019-07-11 06:46:54 +00:00
|
|
|
|
|
|
|
- name: ensure containerd repository is enabled
|
|
|
|
action: "{{ containerd_repo_info.pkg_repo }}"
|
|
|
|
args:
|
|
|
|
repo: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
with_items: "{{ containerd_repo_info.repos }}"
|
|
|
|
when:
|
|
|
|
- ansible_os_family in ['Ubuntu', 'Debian']
|
|
|
|
- containerd_repo_info.repos|length > 0
|
|
|
|
|
|
|
|
- name: Configure containerd repository on Fedora
|
|
|
|
template:
|
|
|
|
src: "fedora_containerd.repo.j2"
|
|
|
|
dest: "{{ yum_repo_dir }}/containerd.repo"
|
2020-03-17 21:31:27 +00:00
|
|
|
when: ansible_distribution == "Fedora"
|
2019-07-11 06:46:54 +00:00
|
|
|
|
|
|
|
- name: Configure containerd repository on RedHat/CentOS
|
|
|
|
template:
|
|
|
|
src: "rh_containerd.repo.j2"
|
|
|
|
dest: "{{ yum_repo_dir }}/containerd.repo"
|
2020-03-17 21:31:27 +00:00
|
|
|
when: ansible_distribution in ["CentOS","RedHat"]
|
2019-07-11 06:46:54 +00:00
|
|
|
|
|
|
|
- name: check if container-selinux is available
|
|
|
|
yum:
|
|
|
|
list: "container-selinux"
|
|
|
|
register: yum_result
|
2020-03-17 21:31:27 +00:00
|
|
|
when: ansible_distribution in ["CentOS","RedHat"]
|
2019-07-11 06:46:54 +00:00
|
|
|
|
|
|
|
- name: Configure extras repository on RedHat/CentOS if container-selinux is not available in current repos
|
|
|
|
yum_repository:
|
|
|
|
name: extras
|
2020-11-24 16:33:00 +00:00
|
|
|
description: "CentOS-{{ ansible_distribution_major_version }} - Extras"
|
2019-07-11 06:46:54 +00:00
|
|
|
state: present
|
|
|
|
baseurl: "{{ extras_rh_repo_base_url }}"
|
|
|
|
file: "extras"
|
2020-03-30 08:13:53 +00:00
|
|
|
gpgcheck: "{{ 'yes' if extras_rh_repo_gpgkey else 'no' }}"
|
2019-07-11 06:46:54 +00:00
|
|
|
gpgkey: "{{ extras_rh_repo_gpgkey }}"
|
|
|
|
keepcache: "{{ containerd_rpm_keepcache | default('1') }}"
|
|
|
|
proxy: " {{ http_proxy | default('_none_') }}"
|
|
|
|
when:
|
2020-03-17 21:31:27 +00:00
|
|
|
- ansible_distribution in ["CentOS","RedHat"]
|
2019-07-11 06:46:54 +00:00
|
|
|
- yum_result.results | length == 0
|