From 816edfc47a9a38e0e2fe10eec7a9ea719b9dfc0d Mon Sep 17 00:00:00 2001 From: David Galloway Date: Thu, 30 Apr 2020 10:37:49 -0400 Subject: [PATCH] common: Set release when registering Because we're running Satellite in a VM in RHV on Gluster, we get really slow I/O performance. Sadly *well* below the recommended performance: https://access.redhat.com/solutions/3397771 When attempting to set the release in a task later in this tasklist, Satellite would throw 500 errors because it was busy still trying to let the postgres DB know the system had been registered. Setting the release during registration will save minutes per registration. Signed-off-by: David Galloway --- roles/common/README.rst | 3 ++- roles/common/tasks/rhel-entitlements.yml | 15 ++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/roles/common/README.rst b/roles/common/README.rst index 01b6a0e..d6b80bc 100644 --- a/roles/common/README.rst +++ b/roles/common/README.rst @@ -31,13 +31,14 @@ secrets repo. ``rhsm_repos`` is a list of Red Hat repos that a system should subscribe to. We have them defined in ``roles/common/vars/redhat_{6,7}.yml``. -``use_satellite`` is a boolean that sets whether a local Red Hat Satellite server is available and should be used instead of Red Hat's CDN. If ``use_satellite`` is set to true, you must also define ``subscription_manager_activationkey``, ``subscription_manager_org``, and ``satellite_cert_rpm`` in your secrets repo. See example:: +``use_satellite`` is a boolean that sets whether a local Red Hat Satellite server is available and should be used instead of Red Hat's CDN. If ``use_satellite`` is set to true, you must also define ``subscription_manager_activationkey``, ``subscription_manager_org``, and ``satellite_cert_rpm`` in your secrets repo. ``set_rhsm_release: true`` will add ``--release=X.Y`` to the ``subscription-manager register`` command; This prevents a RHEL7.6 install from being upgraded to RHEL7.7, for example.:: # Red Hat Satellite vars use_satellite: true satellite_cert_rpm: "http://satellite.example.com/pub/katello-ca-consumer-latest.noarch.rpm" subscription_manager_org: "Your Org" subscription_manager_activationkey: "abc123" + set_rhsm_release: false ``epel_mirror_baseurl`` is self explanatory and defined in ``roles/common/defaults/main.yml``. Can be overwritten in secrets if you run diff --git a/roles/common/tasks/rhel-entitlements.yml b/roles/common/tasks/rhel-entitlements.yml index 3215a92..be21edb 100644 --- a/roles/common/tasks/rhel-entitlements.yml +++ b/roles/common/tasks/rhel-entitlements.yml @@ -36,10 +36,14 @@ set_fact: rhsm_registered: "{{ subscription.rc == 0 }}" +# A `dnf group upgrade base` which happens later in the testnodes role will +# update a 8.X system to 8.Y. We don't want that to happen because we +# expect to test on a specific version. set_rhsm_release=true locks a 8.X install to 8.X packages. - name: Register with subscription-manager. command: subscription-manager register --activationkey={{ subscription_manager_activationkey }} --org={{ subscription_manager_org }} + {% if set_rhsm_release|default(false)|bool == true %}--release={{ ansible_distribution_version }}{% endif %} --force no_log: true when: rhsm_registered == false and have_entitlements == true @@ -90,17 +94,6 @@ import_tasks: beta_repos.yml when: ansible_distribution_version not in rhsm_release_list.stdout_lines -# A `dnf group upgrade base` which happens later in the testnodes role will -# update a 8.X system to 8.Y. We don't want that to happen because we -# expect to test on a specific version. This locks a 8.X install to 8.X packages. -- name: Set release number - command: "subscription-manager release --set={{ ansible_distribution_version }}" - when: rhsm_registered == true - register: release_set - until: release_set is success - retries: 12 - delay: 10 - - name: Get list of enabled RHSM repos shell: subscription-manager repos --list | grep -B4 'Enabled:.*1' | grep 'Repo ID:' | sed -e 's/Repo ID:\s*\(.*\)/\1/' | sort register: repo_list_cmd -- 2.39.5