From 43216436ab547b14eb9dd35554d700bf83f34a1f Mon Sep 17 00:00:00 2001 From: Louis Tu <92532497+tu1h@users.noreply.github.com> Date: Thu, 13 Apr 2023 11:04:35 +0800 Subject: [PATCH] disable rhsm repo when rhel_enable_repos is false (#9973) Signed-off-by: tu1h --- roles/bootstrap-os/tasks/bootstrap-redhat.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/roles/bootstrap-os/tasks/bootstrap-redhat.yml b/roles/bootstrap-os/tasks/bootstrap-redhat.yml index 8f323882c..e48f5680e 100644 --- a/roles/bootstrap-os/tasks/bootstrap-redhat.yml +++ b/roles/bootstrap-os/tasks/bootstrap-redhat.yml @@ -76,9 +76,8 @@ name: - "rhel-7-server-rpms" - "rhel-7-server-extras-rpms" - state: enabled + state: "{{ 'enabled' if (rhel_enable_repos | default(True) | bool) else 'disabled' }}" when: - - rhel_enable_repos | default(True) | bool - ansible_distribution_major_version == "7" # container-selinux is in appstream repo @@ -87,9 +86,8 @@ name: - "rhel-8-for-*-baseos-rpms" - "rhel-8-for-*-appstream-rpms" - state: enabled + state: "{{ 'enabled' if (rhel_enable_repos | default(True) | bool) else 'disabled' }}" when: - - rhel_enable_repos | default(True) | bool - ansible_distribution_major_version == "8" - name: Check presence of fastestmirror.conf