From: cel@kernel.org
To: <kdevops@lists.linux.dev>
Cc: Anna Schumaker <anna@kernel.org>, Chuck Lever <chuck.lever@oracle.com>
Subject: [PATCH v2 1/3] codereadyrepo: Refactor to prepare for more complex usage scenarios
Date: Sat, 14 Dec 2024 12:01:37 -0500 [thread overview]
Message-ID: <20241214170139.253602-2-cel@kernel.org> (raw)
In-Reply-To: <20241214170139.253602-1-cel@kernel.org>
From: Chuck Lever <chuck.lever@oracle.com>
I'm about to add a few more cases that the codereadyrepo role needs
to handle. The only difference for all of these cases is the name of
the repo to enable, so pull out the selection of that name, then do
the repo enablement task only when a repo name was found.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
playbooks/roles/codereadyrepo/tasks/main.yml | 26 +++++++++++++++-----
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/playbooks/roles/codereadyrepo/tasks/main.yml b/playbooks/roles/codereadyrepo/tasks/main.yml
index 71ad05c9d539..7cf6d83bcccf 100644
--- a/playbooks/roles/codereadyrepo/tasks/main.yml
+++ b/playbooks/roles/codereadyrepo/tasks/main.yml
@@ -1,14 +1,28 @@
---
-- 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
+- name: Select the RHEL CodeReady Builder repo
+ ansible.builtin.set_fact:
+ codeready_repo: "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
+- name: Select the CentOS CodeReady Builder repo
+ ansible.builtin.set_fact:
+ codeready_repo: "crb"
when:
- ansible_distribution == 'CentOS'
- not devconfig_custom_yum_repofile
+
+- name: Enable the selected CodeReady Builder repo
+ become: true
+ become_method: ansible.builtin.sudo
+ ansible.builtin.command:
+ argv:
+ - "/usr/bin/dnf"
+ - "config-manager"
+ - "--enable"
+ - "{{ codeready_repo }}"
+ register: dnf_result
+ when:
+ - codeready_repo is defined
+ changed_when: dnf_result is success
--
2.47.1
next prev parent reply other threads:[~2024-12-14 17:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-14 17:01 [PATCH v2 0/3] Recent fixes cel
2024-12-14 17:01 ` cel [this message]
2024-12-14 17:01 ` [PATCH v2 2/3] codereadyrepo: Repo name for Oracle Linux cel
2024-12-14 17:01 ` [PATCH v2 3/3] codereadyrepo: Enable codeready-builder for AWS's RHEL 9 cel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241214170139.253602-2-cel@kernel.org \
--to=cel@kernel.org \
--cc=anna@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=kdevops@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox