``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
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
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