This role will register or unregister a system using subscription-manager, and can also enable or disable
repositories available via subscription.
Ansible 2.4 or higher
Red Hat Enterprise Linux 7 or equivalent
Valid Red Hat Subscriptions
Currently the following variables are supported:
Vars in this section directly correspond to the args available to the redhat_subscription module.
rhsm_username- access.redhat.com or Satellite (RHSM Provider) usernamerhsm_password- access.redhat.com or Satellite (RHSM Provider) usernamerhsm_org_id- RHSM Provider organization IDrhsm_activationkey- RHSM Provider activation keyrhsm_server_hostname- hostname for alternate RHSM providerrhsm_server_insecure- disable certificate verification when connecting to RHSM Provider (bool, default false)rhsm_baseurl- Alternate base URL of package repositories if not using Red Hat CDNrhsm_server_proxy_hostname- HTTP proxy hostnamerhsm_server_proxy_port- HTTP proxy portrhsm_server_proxy_user- HTTP proxy usernamerhsm_server_proxy_password- HTTP proxy passwordrhsm_auto_attach- automatically consume from available subscriptions if registration succeeds (bool, default false, requires ansible >= 2.5)rhsm_environment- Register with a specific environment in the destination org. (Used with Red Hat Satellite 6 or Katello)rhsm_pool- Specific pool name to consume (regex can be used as input). Userhsm_pool_idswhen possible as it is much faster. Mutually exclusive withrhsm_pool_idsrhsm_pool_ids- List of pool IDs to consume, or a list of dicts with pool IDs as keys and quantity of entitlements to consume as values. Mutually exclusive withrhsm_poolrhsm_consumer_type- The type of unit to register (defaults to "system")rhsm_consumer_name- Name of the system to register (defaults to system hostname)rhsm_consumer_id- Existing consumer ID to resume a previous registrationrhsm_force_register- Register the system even if it is already registered (bool, default false)rhsm_unregister- Unregister a system if true (bool, default false, system will be unsubscribed before subscription is attempted)
rhsm_repositories- Specifies which repositories to enable/disable, details below
To enable/disable specific repositories:
rhsm_repositories:
enabled:
- enabled-repository
disabled:
- disabled-repositoryThe list of repositories in disabled is processed before enabled.
To enable only specific repositoryies and disable all others:
rhsm_repositories:
only:
- enabled-repository-1
- enabled-repository-2Using only is an idempotence-friendly version of the following:
rhsm_repositories:
disabled:
- "*"
enabled:
- enabled-repository-1
- enabled-repository-2Note that globbing in repository names is supported.
Use of only is mutually exclusive with the use of enabled and disabled, and the use of only takes precedence.
Requires a system that supports the installation and usage of subscription-manager, e.g. Red Hat Enterprise Linux.
Privilege escalation (sudo) is required for this role to function.
This example registers a system with a username and password, auto-attaches, and enables three RHEL 7 repositories.
- hosts: rhsm-servers
roles:
- role: rhsm
vars:
rhsm_username: your_username
rhsm_password: your_password
rhsm_auto_attach: true
rhsm_repositories:
only:
- rhel-7-server-rpms
- rhel-7-server-optional-rpms
- rhel-7-server-extras-rpmsThis example registers a system to Red Hat Satellite 6 using an organization ID and activation key, and attaches to a specific pool by ID.
- hosts: rhsm-servers
roles:
- role: rhsm
vars:
rhsm_org_id: your_organization_id
rhsm_activitionkey: activation_key
rhsm_pool_ids:
- poolid
rhsm_server_hostname: your.satellite6.hostnameCA Certificates for Satellite 6 or Katello host should be installed first for HTTPS to work when being used as the RHSM Provider.
BSD
Sean Myers [email protected]