Make it more explicit that rhsm_activation_key and rhsm_repos are exclusive

If the operator is using an activation key, the repositories that are
associated to the subscription are configured in the Red Hat portal or in the
local instance of Satellite if any.
We can't specify rhsm_repos parameter if you are using rhsm_activation_key.
Otherwise, if you we rhsm_username and rhsm_password, we can use rhsm_repos
to select which parameters are deployed.

This patch:
- adds a debug message in the tasks/main when both options are defined.
- documents this situation in the README.
- adds 2 use cases in the README, one with Satellite and one with
  Portal.

Change-Id: I6448d2f7258c2b00b8617f8e12fd06b53d28dc83
This commit is contained in:
Emilien Macchi 2018-11-27 13:15:24 -05:00
parent 5f8dd387a9
commit 6eae85cba8
2 changed files with 39 additions and 3 deletions

View File

@ -59,8 +59,20 @@ Dependencies
None.
Example Playbook
----------------
About repositories
------------------
If you are using an activation key, the repositories that are associated to
the subscription are configured in the Red Hat portal or in your local
instance of Satellite. You can't specify rhsm_repos parameter if you are
using rhsm_activation_key.
Otherwise, if you use rhsm_username and rhsm_password, you can use rhsm_repos
to select which parameters are deployed.
Example Playbook with Red Hat portal
------------------------------------
::
@ -69,9 +81,26 @@ Example Playbook
rhsm_username: bob.smith@acme.com
rhsm_password: "{{ vault_rhsm_password }}"
rhsm_repos:
- rhel-7-server-rpms
- rhel-7-server-extras-rpms
- rhel-7-server-rh-common-rpms
- rhel-7-server-openstack-8-rpms
- rhel-ha-for-rhel-7-server-rpms
roles:
- openstack.redhat-subscription
Example Playbook with Satellite 6
---------------------------------
::
- hosts: all
vars:
rhsm_activation_key: "secrete_key"
rhsm_org_id: "Default_Organization"
rhsm_server_hostname: "mysatserver.com"
rhsm_baseurl: "https://mysatserver.com/pulp/repos"
rhsm_method: satellite
rhsm_insecure: yes
roles:
- openstack.redhat-subscription

View File

@ -4,6 +4,13 @@
tags:
- rhsm
- name: Inform the operators if both rhsm_activation_key and rhsm_repos are given
debug:
msg: "rhsm_repos and rhsm_activation_key are exclusive options"
when:
- rhsm_repos | length > 0
- rhsm_activation_key is defined
- name: Configure Red Hat Subscription Manager
template:
src: rhsm.conf.j2