From b0e4c375a7df6b0865a19b4a4a7ffee5e0302958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Huss?= Date: Sat, 10 Jul 2021 05:52:45 +0200 Subject: [PATCH] Allow cri-o offline install (#7777) --- inventory/sample/group_vars/all/offline.yml | 4 ++++ .../container-engine/cri-o/defaults/main.yml | 6 +++++ .../cri-o/tasks/crio_repo.yml | 22 +++++++++---------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/inventory/sample/group_vars/all/offline.yml b/inventory/sample/group_vars/all/offline.yml index 3bdefcded..1a559d543 100644 --- a/inventory/sample/group_vars/all/offline.yml +++ b/inventory/sample/group_vars/all/offline.yml @@ -44,6 +44,10 @@ # [Optional] kata: only if you set kata_containers_enabled: true # kata_containers_download_url: "{{ files_repo }}/kata-containers/runtime/releases/download/{{ kata_containers_version }}/kata-static-{{ kata_containers_version }}-{{ ansible_architecture }}.tar.xz" +# [Optional] cri-o: only if you set container_manager: crio +# crio_download_base: "download.opensuse.org/repositories/devel:kubic:libcontainers:stable" +# crio_download_crio: "http://{{ crio_download_base }}:/cri-o:/" + ## CentOS/Redhat/AlmaLinux ### For EL7, base and extras repo must be available, for EL8, baseos and appstream ### By default we enable those repo automatically diff --git a/roles/container-engine/cri-o/defaults/main.yml b/roles/container-engine/cri-o/defaults/main.yml index 742d94985..bc9092fd7 100644 --- a/roles/container-engine/cri-o/defaults/main.yml +++ b/roles/container-engine/cri-o/defaults/main.yml @@ -78,6 +78,12 @@ crun_runtime: # environment with preconfigured CRI-O package repositories. crio_add_repos: true +# Allow crio offline installation +crio_download_base: "download.opensuse.org/repositories/devel:kubic:libcontainers:stable" + +# Allow crio offline installation +crio_download_crio: "http://{{ crio_download_base }}:/cri-o:/" + # skopeo need for save/load images when download_run_once=true skopeo_packages: - "skopeo" diff --git a/roles/container-engine/cri-o/tasks/crio_repo.yml b/roles/container-engine/cri-o/tasks/crio_repo.yml index 62f492191..23447ee43 100644 --- a/roles/container-engine/cri-o/tasks/crio_repo.yml +++ b/roles/container-engine/cri-o/tasks/crio_repo.yml @@ -7,7 +7,7 @@ - name: Add CRI-O kubic apt repo key apt_key: - url: "https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/{{ crio_kubic_debian_repo_name }}/Release.key" + url: "https://{{ crio_download_base }}/{{ crio_kubic_debian_repo_name }}/Release.key" state: present when: crio_kubic_debian_repo_name is defined register: apt_key_download @@ -18,14 +18,14 @@ - name: Add CRI-O kubic apt repo apt_repository: - repo: "deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/{{ crio_kubic_debian_repo_name }}/ /" + repo: "deb http://{{ crio_download_base }}/{{ crio_kubic_debian_repo_name }}/ /" state: present filename: devel-kubic-libcontainers-stable when: crio_kubic_debian_repo_name is defined - name: Add CRI-O kubic cri-o apt repo apt_repository: - repo: "deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ crio_version }}/{{ crio_kubic_debian_repo_name }}/ /" + repo: "deb {{ crio_download_crio }}{{ crio_version }}/{{ crio_kubic_debian_repo_name }}/ /" state: present filename: devel-kubic-libcontainers-stable-cri-o when: crio_kubic_debian_repo_name is defined @@ -75,9 +75,9 @@ yum_repository: name: devel_kubic_libcontainers_stable description: Stable Releases of Upstream github.com/containers packages (CentOS_$releasever) - baseurl: http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_{{ ansible_distribution_major_version }}/ + baseurl: http://{{ crio_download_base }}/CentOS_{{ ansible_distribution_major_version }}/ gpgcheck: yes - gpgkey: http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_{{ ansible_distribution_major_version }}/repodata/repomd.xml.key + gpgkey: http://{{ crio_download_base }}/CentOS_{{ ansible_distribution_major_version }}/repodata/repomd.xml.key keepcache: '0' when: - ansible_os_family == "RedHat" @@ -87,9 +87,9 @@ yum_repository: name: "devel_kubic_libcontainers_stable_cri-o_{{ crio_version }}" description: "CRI-O {{ crio_version }} (CentOS_$releasever)" - baseurl: "http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ crio_version }}/CentOS_{{ ansible_distribution_major_version }}/" + baseurl: "{{ crio_download_crio }}{{ crio_version }}/CentOS_{{ ansible_distribution_major_version }}/" gpgcheck: yes - gpgkey: "http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ crio_version }}/CentOS_{{ ansible_distribution_major_version }}/repodata/repomd.xml.key" + gpgkey: "{{ crio_download_crio }}{{ crio_version }}/CentOS_{{ ansible_distribution_major_version }}/repodata/repomd.xml.key" when: - ansible_os_family == "RedHat" - ansible_distribution not in ["Amazon", "Fedora"] @@ -98,9 +98,9 @@ yum_repository: name: devel_kubic_libcontainers_stable description: Stable Releases of Upstream github.com/containers packages - baseurl: http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_7/ + baseurl: http://{{ crio_download_base }}/CentOS_7/ gpgcheck: yes - gpgkey: http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_7/repodata/repomd.xml.key + gpgkey: http://{{ crio_download_base }}/CentOS_7/repodata/repomd.xml.key keepcache: '0' when: ansible_distribution in ["Amazon"] @@ -108,9 +108,9 @@ yum_repository: name: "devel_kubic_libcontainers_stable_cri-o_{{ crio_version }}" description: "CRI-O {{ crio_version }}" - baseurl: "http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ crio_version }}/CentOS_7/" + baseurl: "{{ crio_download_crio }}{{ crio_version }}/CentOS_7/" gpgcheck: yes - gpgkey: "http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ crio_version }}/CentOS_7/repodata/repomd.xml.key" + gpgkey: "{{ crio_download_crio }}{{ crio_version }}/CentOS_7/repodata/repomd.xml.key" when: ansible_distribution in ["Amazon"] - name: Enable modular repos for CRI-O