diff mbox series

[5/6] playbooks: Add a Code Ready Builder role

Message ID 20241210192920.682914-6-cel@kernel.org (mailing list archive)
State New
Headers show
Series Recent fixes | expand

Commit Message

Chuck Lever Dec. 10, 2024, 7:29 p.m. UTC
From: Chuck Lever <chuck.lever@oracle.com>

Installing Code Ready Builder turns out to be complicated by the way
the package is named on various cloud providers. Since there is more
than one workflow that wants to install CRB, move the installation
mechanism to its own role so that can be included in each workflow
that might need it.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 playbooks/roles/codereadyrepo/tasks/main.yml       | 14 ++++++++++++++
 .../fstests/tasks/install-deps/redhat/main.yml     | 14 ++------------
 .../roles/pynfs/tasks/install-deps/redhat/main.yml | 14 ++------------
 .../sysbench/tasks/install-deps/redhat/main.yml    | 14 ++------------
 4 files changed, 20 insertions(+), 36 deletions(-)
 create mode 100644 playbooks/roles/codereadyrepo/tasks/main.yml
diff mbox series

Patch

diff --git a/playbooks/roles/codereadyrepo/tasks/main.yml b/playbooks/roles/codereadyrepo/tasks/main.yml
new file mode 100644
index 000000000000..71ad05c9d539
--- /dev/null
+++ b/playbooks/roles/codereadyrepo/tasks/main.yml
@@ -0,0 +1,14 @@ 
+---
+- name: Enable the CodeReady repo
+  become: yes
+  ansible.builtin.command: /usr/bin/dnf config-manager --enable codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms
+  when:
+    - ansible_distribution == 'RedHat'
+    - not devconfig_custom_yum_repofile
+
+- name: Enable the CodeReady repo
+  become: yes
+  ansible.builtin.command: /usr/bin/dnf config-manager --enable crb
+  when:
+    - ansible_distribution == 'CentOS'
+    - not devconfig_custom_yum_repofile
diff --git a/playbooks/roles/fstests/tasks/install-deps/redhat/main.yml b/playbooks/roles/fstests/tasks/install-deps/redhat/main.yml
index 1c238979d7d5..655afa3b9cc8 100644
--- a/playbooks/roles/fstests/tasks/install-deps/redhat/main.yml
+++ b/playbooks/roles/fstests/tasks/install-deps/redhat/main.yml
@@ -1,17 +1,7 @@ 
 ---
 - name: Enable the CodeReady repo
-  become: yes
-  command: /usr/bin/dnf config-manager --enable codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms
-  when:
-    - ansible_distribution == 'RedHat'
-    - not devconfig_custom_yum_repofile
-
-- name: Enable the CodeReady repo
-  become: yes
-  command: /usr/bin/dnf config-manager --enable crb
-  when:
-    - ansible_distribution == 'CentOS'
-    - not devconfig_custom_yum_repofile
+  ansible.builtin.include_role:
+    name: codereadyrepo
 
 - name: Install epel-release if we're not on Fedora
   become: yes
diff --git a/playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml b/playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml
index f4aee14c5430..93513c426263 100644
--- a/playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml
+++ b/playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml
@@ -1,17 +1,7 @@ 
 ---
 - name: Enable the CodeReady repo
-  become: yes
-  command: /usr/bin/dnf config-manager --enable codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms
-  when:
-    - ansible_distribution == 'RedHat'
-    - not devconfig_custom_yum_repofile
-
-- name: Enable the CodeReady repo
-  become: yes
-  command: /usr/bin/dnf config-manager --enable crb
-  when:
-    - ansible_distribution == 'CentOS'
-    - not devconfig_custom_yum_repofile
+  ansible.builtin.include_role:
+    name: codereadyrepo
 
 - name: Install build dependencies for pynfs
   become: yes
diff --git a/playbooks/roles/sysbench/tasks/install-deps/redhat/main.yml b/playbooks/roles/sysbench/tasks/install-deps/redhat/main.yml
index abe95cb0c5a0..4602d7e6cf5a 100644
--- a/playbooks/roles/sysbench/tasks/install-deps/redhat/main.yml
+++ b/playbooks/roles/sysbench/tasks/install-deps/redhat/main.yml
@@ -1,17 +1,7 @@ 
 ---
 - name: Enable the CodeReady repo
-  become: yes
-  command: /usr/bin/dnf config-manager --enable codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms
-  when:
-    - ansible_distribution == 'RedHat'
-    - not devconfig_custom_yum_repofile
-
-- name: Enable the CodeReady repo
-  become: yes
-  command: /usr/bin/dnf config-manager --enable crb
-  when:
-    - ansible_distribution == 'CentOS'
-    - not devconfig_custom_yum_repofile
+  ansible.builtin.include_role:
+    name: codereadyrepo
 
 - name: Install epel-release if we're not on Fedora
   become: yes