2020-04-22 20:29:45 +00:00
|
|
|
---
|
|
|
|
|
2021-07-23 14:07:16 +00:00
|
|
|
- block:
|
|
|
|
- name: Add Debian Backports apt repo
|
|
|
|
apt_repository:
|
|
|
|
repo: "deb http://deb.debian.org/debian {{ ansible_distribution_release }}-backports main"
|
|
|
|
state: present
|
|
|
|
filename: debian-backports
|
|
|
|
|
|
|
|
- name: Set libseccomp2 pin priority to apt_preferences on Debian buster
|
|
|
|
copy:
|
|
|
|
content: |
|
|
|
|
Package: libseccomp2
|
|
|
|
Pin: release a={{ ansible_distribution_release }}-backports
|
|
|
|
Pin-Priority: 1001
|
|
|
|
dest: "/etc/apt/preferences.d/libseccomp2"
|
|
|
|
owner: "root"
|
|
|
|
mode: 0644
|
|
|
|
when:
|
|
|
|
- ansible_distribution == "Debian"
|
|
|
|
- ansible_distribution_version == "10"
|
|
|
|
|
2020-04-24 08:18:07 +00:00
|
|
|
- name: CRI-O kubic repo name for debian os family
|
|
|
|
set_fact:
|
|
|
|
crio_kubic_debian_repo_name: "{{ ((ansible_distribution == 'Ubuntu') | ternary('x','')) ~ ansible_distribution ~ '_' ~ ansible_distribution_version }}"
|
|
|
|
when: ansible_os_family == "Debian"
|
|
|
|
|
2020-10-13 09:08:26 +00:00
|
|
|
- name: Add CRI-O kubic apt repo key
|
2020-04-22 20:29:45 +00:00
|
|
|
apt_key:
|
2021-07-10 03:52:45 +00:00
|
|
|
url: "https://{{ crio_download_base }}/{{ crio_kubic_debian_repo_name }}/Release.key"
|
2020-04-22 20:29:45 +00:00
|
|
|
state: present
|
2020-04-24 08:18:07 +00:00
|
|
|
when: crio_kubic_debian_repo_name is defined
|
2020-07-07 19:32:01 +00:00
|
|
|
register: apt_key_download
|
|
|
|
until: apt_key_download is succeeded
|
|
|
|
retries: 4
|
|
|
|
delay: "{{ retry_stagger | d(3) }}"
|
2021-04-13 08:20:51 +00:00
|
|
|
environment: "{{ proxy_env }}"
|
2020-04-22 20:29:45 +00:00
|
|
|
|
2020-10-13 09:08:26 +00:00
|
|
|
- name: Add CRI-O kubic apt repo
|
2020-04-22 20:29:45 +00:00
|
|
|
apt_repository:
|
2021-07-10 03:52:45 +00:00
|
|
|
repo: "deb http://{{ crio_download_base }}/{{ crio_kubic_debian_repo_name }}/ /"
|
2020-04-22 20:29:45 +00:00
|
|
|
state: present
|
2020-10-13 09:08:26 +00:00
|
|
|
filename: devel-kubic-libcontainers-stable
|
2020-04-24 08:18:07 +00:00
|
|
|
when: crio_kubic_debian_repo_name is defined
|
2020-04-22 20:29:45 +00:00
|
|
|
|
2020-10-13 09:08:26 +00:00
|
|
|
- name: Add CRI-O kubic cri-o apt repo
|
|
|
|
apt_repository:
|
2021-07-10 03:52:45 +00:00
|
|
|
repo: "deb {{ crio_download_crio }}{{ crio_version }}/{{ crio_kubic_debian_repo_name }}/ /"
|
2020-10-13 09:08:26 +00:00
|
|
|
state: present
|
|
|
|
filename: devel-kubic-libcontainers-stable-cri-o
|
|
|
|
when: crio_kubic_debian_repo_name is defined
|
|
|
|
|
2021-03-19 00:16:37 +00:00
|
|
|
- name: Check that amzn2-extras.repo exists
|
|
|
|
stat:
|
|
|
|
path: /etc/yum.repos.d/amzn2-extras.repo
|
|
|
|
register: amzn2_extras_file_stat
|
|
|
|
when: ansible_distribution in ["Amazon"]
|
|
|
|
|
|
|
|
- name: Find docker repo in amzn2-extras.repo file
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/yum.repos.d/amzn2-extras.repo
|
|
|
|
line: "[amzn2extra-docker]"
|
|
|
|
check_mode: yes
|
|
|
|
register: amzn2_extras_docker_repo
|
|
|
|
when:
|
|
|
|
- ansible_distribution in ["Amazon"]
|
|
|
|
- amzn2_extras_file_stat.stat.exists
|
|
|
|
|
|
|
|
- name: Remove docker repository
|
|
|
|
ini_file:
|
|
|
|
dest: /etc/yum.repos.d/amzn2-extras.repo
|
|
|
|
section: amzn2extra-docker
|
|
|
|
option: enabled
|
|
|
|
value: "0"
|
|
|
|
backup: yes
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0644
|
2021-03-19 00:16:37 +00:00
|
|
|
when:
|
|
|
|
- ansible_distribution in ["Amazon"]
|
|
|
|
- amzn2_extras_file_stat.stat.exists
|
|
|
|
- not amzn2_extras_docker_repo.changed
|
|
|
|
|
|
|
|
- name: Add container-selinux yum repo
|
|
|
|
yum_repository:
|
|
|
|
name: copr:copr.fedorainfracloud.org:lsm5:container-selinux
|
|
|
|
file: _copr_lsm5-container-selinux.repo
|
|
|
|
description: Copr repo for container-selinux owned by lsm5
|
|
|
|
baseurl: https://download.copr.fedorainfracloud.org/results/lsm5/container-selinux/epel-7-$basearch/
|
|
|
|
gpgcheck: yes
|
|
|
|
gpgkey: https://download.copr.fedorainfracloud.org/results/lsm5/container-selinux/pubkey.gpg
|
|
|
|
skip_if_unavailable: yes
|
|
|
|
enabled: yes
|
|
|
|
repo_gpgcheck: no
|
|
|
|
when: ansible_distribution in ["Amazon"]
|
|
|
|
|
2020-10-13 09:08:26 +00:00
|
|
|
- name: Add CRI-O kubic yum repo
|
2020-04-22 20:29:45 +00:00
|
|
|
yum_repository:
|
2020-04-24 08:18:07 +00:00
|
|
|
name: devel_kubic_libcontainers_stable
|
|
|
|
description: Stable Releases of Upstream github.com/containers packages (CentOS_$releasever)
|
2021-07-10 03:52:45 +00:00
|
|
|
baseurl: http://{{ crio_download_base }}/CentOS_{{ ansible_distribution_major_version }}/
|
2020-04-24 08:18:07 +00:00
|
|
|
gpgcheck: yes
|
2021-07-10 03:52:45 +00:00
|
|
|
gpgkey: http://{{ crio_download_base }}/CentOS_{{ ansible_distribution_major_version }}/repodata/repomd.xml.key
|
2021-04-21 14:20:11 +00:00
|
|
|
keepcache: '0'
|
2021-04-26 16:11:02 +00:00
|
|
|
when:
|
|
|
|
- ansible_os_family == "RedHat"
|
|
|
|
- ansible_distribution not in ["Amazon", "Fedora"]
|
2020-04-22 20:29:45 +00:00
|
|
|
|
2020-10-13 09:08:26 +00:00
|
|
|
- name: Add CRI-O kubic yum repo
|
2020-04-24 08:18:07 +00:00
|
|
|
yum_repository:
|
|
|
|
name: "devel_kubic_libcontainers_stable_cri-o_{{ crio_version }}"
|
2020-06-04 08:08:44 +00:00
|
|
|
description: "CRI-O {{ crio_version }} (CentOS_$releasever)"
|
2021-07-10 03:52:45 +00:00
|
|
|
baseurl: "{{ crio_download_crio }}{{ crio_version }}/CentOS_{{ ansible_distribution_major_version }}/"
|
2020-04-24 08:18:07 +00:00
|
|
|
gpgcheck: yes
|
2021-07-10 03:52:45 +00:00
|
|
|
gpgkey: "{{ crio_download_crio }}{{ crio_version }}/CentOS_{{ ansible_distribution_major_version }}/repodata/repomd.xml.key"
|
2021-04-26 16:11:02 +00:00
|
|
|
when:
|
|
|
|
- ansible_os_family == "RedHat"
|
|
|
|
- ansible_distribution not in ["Amazon", "Fedora"]
|
2020-04-24 08:18:07 +00:00
|
|
|
|
2021-03-19 00:16:37 +00:00
|
|
|
- name: Add CRI-O kubic yum repo
|
|
|
|
yum_repository:
|
|
|
|
name: devel_kubic_libcontainers_stable
|
|
|
|
description: Stable Releases of Upstream github.com/containers packages
|
2021-07-10 03:52:45 +00:00
|
|
|
baseurl: http://{{ crio_download_base }}/CentOS_7/
|
2021-03-19 00:16:37 +00:00
|
|
|
gpgcheck: yes
|
2021-07-10 03:52:45 +00:00
|
|
|
gpgkey: http://{{ crio_download_base }}/CentOS_7/repodata/repomd.xml.key
|
2021-04-21 14:20:11 +00:00
|
|
|
keepcache: '0'
|
2021-03-19 00:16:37 +00:00
|
|
|
when: ansible_distribution in ["Amazon"]
|
|
|
|
|
|
|
|
- name: Add CRI-O kubic yum repo
|
|
|
|
yum_repository:
|
|
|
|
name: "devel_kubic_libcontainers_stable_cri-o_{{ crio_version }}"
|
|
|
|
description: "CRI-O {{ crio_version }}"
|
2021-07-10 03:52:45 +00:00
|
|
|
baseurl: "{{ crio_download_crio }}{{ crio_version }}/CentOS_7/"
|
2021-03-19 00:16:37 +00:00
|
|
|
gpgcheck: yes
|
2021-07-10 03:52:45 +00:00
|
|
|
gpgkey: "{{ crio_download_crio }}{{ crio_version }}/CentOS_7/repodata/repomd.xml.key"
|
2021-03-19 00:16:37 +00:00
|
|
|
when: ansible_distribution in ["Amazon"]
|
|
|
|
|
2020-04-24 08:18:07 +00:00
|
|
|
- name: Enable modular repos for CRI-O
|
2020-04-22 20:29:45 +00:00
|
|
|
ini_file:
|
2020-07-13 14:18:32 +00:00
|
|
|
path: "/etc/yum.repos.d/{{ item.repo }}.repo"
|
|
|
|
section: "{{ item.section }}"
|
2020-04-22 20:29:45 +00:00
|
|
|
option: enabled
|
|
|
|
value: 1
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0644
|
2020-04-22 20:29:45 +00:00
|
|
|
become: true
|
2020-04-24 08:18:07 +00:00
|
|
|
when: is_ostree
|
2020-04-22 20:29:45 +00:00
|
|
|
loop:
|
2020-07-13 14:18:32 +00:00
|
|
|
- repo: "fedora-updates-modular"
|
|
|
|
section: "updates-modular"
|
|
|
|
- repo: "fedora-modular"
|
|
|
|
section: "fedora-modular"
|
2020-04-24 08:18:07 +00:00
|
|
|
|
|
|
|
- name: Enable CRI-O module
|
|
|
|
command: "dnf -y module enable cri-o:{{ crio_version }}"
|
|
|
|
args:
|
|
|
|
warn: False
|
|
|
|
register: crio_dnf_result
|
|
|
|
changed_when: "'Enabling' in crio_dnf_result.stdout"
|
|
|
|
become: true
|
|
|
|
when:
|
|
|
|
- ansible_distribution in ["Fedora"]
|
|
|
|
- not is_ostree
|