From patchwork Sat Dec 14 17:01:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13908526 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A693528F1 for ; Sat, 14 Dec 2024 17:01:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734195702; cv=none; b=IUVv/SZg2UFWsiTKeodYF9FckSzyMVjiE7lu4dHw5S8T1irwYzp3Zgsyiyj/ckPAqwhtUbrGd/kn4C/o3i8Jyyb7oGeoNP/30HJYCxsZbDiYBG1xl1EVl0WJfno5suAnMx50GMuzqWFY9DO9pl5kctxmGxmWVwFVAJ/rOdYTP9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734195702; c=relaxed/simple; bh=gIbVMhJK3FllM0bXdgyIr/H3JYcGsrSBZAqVBuU6pM4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GRVZvYPRBDpsDKkcKegsy7UhElSLtxO+dcVHMzVSBlXwsSVtwqpp0CWuKCRKu5qrlLWDUGQ9ZQbTDR577wnhcpQRpdzmhGtGTziq1/aRToxpjPi+JpU2+f71GAqiPFAUMTmZQbq3sdH9ny3V3260nipR1RdUK6fYmWUKYnk/0fw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L0hYv2ej; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L0hYv2ej" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB6DEC4CED4; Sat, 14 Dec 2024 17:01:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734195702; bh=gIbVMhJK3FllM0bXdgyIr/H3JYcGsrSBZAqVBuU6pM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L0hYv2ejbrdQSn5CBwX5Mzk3RkLgWYH5+FDzPyFNQnu7oHW3Ry0tRJx4Sor1TTEJY /ruoANrGsYvfB3LxDq65J+skemhjsKGnS38LGie/m1GyLLe60z5cT6+VAoiTigEjAT AaKZylFi79rnpOV57agD0U5AE/J164ZH9swQ54JXdlqeMX/QPVr0+h4+kL3Xd+zi7p FOnP/DS6CpvRTDwJEbsC0TJT8U0dzoYKH8SYnc98cV2Ts2KPAqDMbZk36Fmw17xd6N uBoH3ZRNgwGTodhG3cnzZxTBONV8RLdf4nuTM3Xjb00NtP8M4GcWKCgf8IjLg+m5MM 1SMB/nhYJYuqQ== From: cel@kernel.org To: Cc: Anna Schumaker , Chuck Lever Subject: [PATCH v2 1/3] codereadyrepo: Refactor to prepare for more complex usage scenarios Date: Sat, 14 Dec 2024 12:01:37 -0500 Message-ID: <20241214170139.253602-2-cel@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241214170139.253602-1-cel@kernel.org> References: <20241214170139.253602-1-cel@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever 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 --- 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