From 0d8ec0f7a890e75e8b488d84365cd10e2f962e0a Mon Sep 17 00:00:00 2001 From: zhengtianbao Date: Wed, 17 Nov 2021 14:51:24 +0800 Subject: [PATCH 1/2] Enable experimental modules when rpm-ostree version >= 2021.9 --- roles/container-engine/cri-o/tasks/crio_repo.yml | 7 +++++++ roles/container-engine/cri-o/tasks/main.yaml | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/roles/container-engine/cri-o/tasks/crio_repo.yml b/roles/container-engine/cri-o/tasks/crio_repo.yml index 099d2ef643b..ec12d173031 100644 --- a/roles/container-engine/cri-o/tasks/crio_repo.yml +++ b/roles/container-engine/cri-o/tasks/crio_repo.yml @@ -149,6 +149,13 @@ - repo: "fedora-modular" section: "fedora-modular" +- name: Enable CRI-O ex module + command: "rpm-ostree ex module enable cri-o:{{ crio_version }}" + become: true + when: + - is_ostree + - ostree_version is version('2021.9', '>=') + - name: Enable CRI-O module command: "dnf -y module enable cri-o:{{ crio_version }}" args: diff --git a/roles/container-engine/cri-o/tasks/main.yaml b/roles/container-engine/cri-o/tasks/main.yaml index 25b338ed58b..62ae487085c 100644 --- a/roles/container-engine/cri-o/tasks/main.yaml +++ b/roles/container-engine/cri-o/tasks/main.yaml @@ -11,6 +11,21 @@ set_fact: is_ostree: "{{ ostree.stat.exists }}" +- name: get ostree version + shell: "set -o pipefail && rpm-ostree --version |grep 'Version:' |awk '{print $2}'| sed \"s/'//g\" " + args: + executable: /bin/bash + register: ostree_version_on_server + when: is_ostree + +- name: set ostree version + set_fact: + ostree_version: "{{ ostree_version_on_server.stdout }}" + when: + - is_ostree + - 'ostree_version_on_server.stdout is defined' + - ostree_version_on_server.stdout + - name: gather os specific variables include_vars: "{{ item }}" with_first_found: From 722782cddfc222b8e4008ed971d201c1c37aa348 Mon Sep 17 00:00:00 2001 From: zhengtianbao Date: Thu, 18 Nov 2021 10:02:08 +0800 Subject: [PATCH 2/2] cleanup code --- roles/container-engine/cri-o/tasks/crio_repo.yml | 2 +- roles/container-engine/cri-o/tasks/main.yaml | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/roles/container-engine/cri-o/tasks/crio_repo.yml b/roles/container-engine/cri-o/tasks/crio_repo.yml index ec12d173031..51142640c87 100644 --- a/roles/container-engine/cri-o/tasks/crio_repo.yml +++ b/roles/container-engine/cri-o/tasks/crio_repo.yml @@ -154,7 +154,7 @@ become: true when: - is_ostree - - ostree_version is version('2021.9', '>=') + - ostree_version is defined and ostree_version.stdout is version('2021.9', '>=') - name: Enable CRI-O module command: "dnf -y module enable cri-o:{{ crio_version }}" diff --git a/roles/container-engine/cri-o/tasks/main.yaml b/roles/container-engine/cri-o/tasks/main.yaml index 62ae487085c..d3997f4a5ff 100644 --- a/roles/container-engine/cri-o/tasks/main.yaml +++ b/roles/container-engine/cri-o/tasks/main.yaml @@ -12,20 +12,12 @@ is_ostree: "{{ ostree.stat.exists }}" - name: get ostree version - shell: "set -o pipefail && rpm-ostree --version |grep 'Version:' |awk '{print $2}'| sed \"s/'//g\" " + shell: "set -o pipefail && rpm-ostree --version | awk -F\\' '/Version/{print $2}'" args: executable: /bin/bash - register: ostree_version_on_server + register: ostree_version when: is_ostree -- name: set ostree version - set_fact: - ostree_version: "{{ ostree_version_on_server.stdout }}" - when: - - is_ostree - - 'ostree_version_on_server.stdout is defined' - - ostree_version_on_server.stdout - - name: gather os specific variables include_vars: "{{ item }}" with_first_found: