From 50f3e0ff3fbc757401b719fe7766e935bf5fc05f Mon Sep 17 00:00:00 2001 From: Sofer Athlan-Guyot Date: Wed, 20 Jan 2021 17:55:06 +0100 Subject: [PATCH] Allow rhsm subscription test to be overrided in RHOSP deployment. This allow the master playbook used for update to set tripleo_redhat_enforce to false on a per role basis on Red Hat environment. The default in defaults/main.yml is now "true" so that it keeps its behavior of being run by default if nothing is changed in the role definition. We then avoid running it on other plateform than Red Hat by adding an explicit test in that tasks/main.yml file. Overall the behavior is as follows: | Red Hat Env | tripleo_enforced | Test run | |-------------+----------------------+----------| | True | Unset | Yes | | True | Set to true in role | Yes | | True | Set to false in role | No | | False | Doesn't matter | No | Change-Id: I6268a01d16f8288bf862003d19184fc93b88282a Partial-Bug: #1912512 --- .../roles/tripleo_redhat_enforce/defaults/main.yml | 2 +- .../roles/tripleo_redhat_enforce/tasks/enforce_release.yml | 5 +++-- tripleo_ansible/roles/tripleo_redhat_enforce/tasks/main.yml | 4 +++- tripleo_ansible/roles/tripleo_redhat_enforce/vars/redhat.yml | 1 - 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tripleo_ansible/roles/tripleo_redhat_enforce/defaults/main.yml b/tripleo_ansible/roles/tripleo_redhat_enforce/defaults/main.yml index 7ef0e4c02..806afb92c 100644 --- a/tripleo_ansible/roles/tripleo_redhat_enforce/defaults/main.yml +++ b/tripleo_ansible/roles/tripleo_redhat_enforce/defaults/main.yml @@ -19,6 +19,6 @@ # All variables within this role should have a prefix of "tripleo_redhat_enforce" tripleo_redhat_enforce_debug: "{{ (ansible_verbosity | int) >= 2 | bool }}" -tripleo_redhat_enforce: false +tripleo_redhat_enforce: true tripleo_redhat_enforce_osp: '' tripleo_redhat_enforce_os: '' diff --git a/tripleo_ansible/roles/tripleo_redhat_enforce/tasks/enforce_release.yml b/tripleo_ansible/roles/tripleo_redhat_enforce/tasks/enforce_release.yml index e97ae56ab..c692df37c 100644 --- a/tripleo_ansible/roles/tripleo_redhat_enforce/tasks/enforce_release.yml +++ b/tripleo_ansible/roles/tripleo_redhat_enforce/tasks/enforce_release.yml @@ -18,7 +18,7 @@ https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.0/html-single/ director_installation_and_usage/index#configuring-the-undercloud-with-environment-files, for the Overcloud you need to add a new parameter file to your deploy - command with that parameter set. + command with that parameter set. You can also disable it in the role, see rhsm_enforce role parameter. If this is unexpected, you have to subscribe this node and ensure that RHEL is pinned to {{ tripleo_redhat_enforce_os }} as this is the only version supported for {{ tripleo_redhat_enforce_osp }}. @@ -41,5 +41,6 @@ OSP{{ tripleo_redhat_enforce_osp }} is only supported with Red Hat {{ tripleo_redhat_enforce_os }}. Please make sure to pin rhel to {{ tripleo_redhat_enforce_os }} using: subscription-manager release --set={{ tripleo_redhat_enforce_os }}. - You can then proceed with the update. + You can then proceed with the update. You can also disable it in the + role, see rhsm_enforce role parameter, if this is expected. when: tripleo_redhat_enforce_os not in subscribed_release.stdout diff --git a/tripleo_ansible/roles/tripleo_redhat_enforce/tasks/main.yml b/tripleo_ansible/roles/tripleo_redhat_enforce/tasks/main.yml index c1bfaed39..2d7383485 100644 --- a/tripleo_ansible/roles/tripleo_redhat_enforce/tasks/main.yml +++ b/tripleo_ansible/roles/tripleo_redhat_enforce/tasks/main.yml @@ -33,4 +33,6 @@ - include_tasks: enforce_release.yml name: Enforce RHEL/OSP version pair - when: tripleo_redhat_enforce|bool + when: + - (ansible_distribution | lower) == "redhat" + - tripleo_redhat_enforce|bool diff --git a/tripleo_ansible/roles/tripleo_redhat_enforce/vars/redhat.yml b/tripleo_ansible/roles/tripleo_redhat_enforce/vars/redhat.yml index 310e84845..d3120e2a1 100644 --- a/tripleo_ansible/roles/tripleo_redhat_enforce/vars/redhat.yml +++ b/tripleo_ansible/roles/tripleo_redhat_enforce/vars/redhat.yml @@ -18,6 +18,5 @@ # All variables intended for modification should be placed in this file. # All variables within this role should have a prefix of "tripleo_redhat_enforce" -tripleo_redhat_enforce: true tripleo_redhat_enforce_osp: '' tripleo_redhat_enforce_os: ''