From 6eae85cba8cf773d0ce3d981d98ecce04c876dcd Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Tue, 27 Nov 2018 13:15:24 -0500 Subject: [PATCH] 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 --- README.md | 35 ++++++++++++++++++++++++++++++++--- tasks/main.yml | 7 +++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 76429c6..02b7704 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/tasks/main.yml b/tasks/main.yml index 30be962..53dc62c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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