community.general.redhat_subscription – Manage registration and subscriptions to RHSM using the subscription-manager
command
Note
This plugin is part of the community.general collection (version 3.8.3).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.redhat_subscription
.
Synopsis
Manage registration and subscription to the Red Hat Subscription Management entitlement platform using the
subscription-manager
command
Requirements
The below requirements are needed on the host that executes this module.
subscription-manager
Parameters
Parameter |
Comments |
---|---|
supply an activation key for use with registration |
|
Upon successful registration, auto-consume available subscriptions Added in favor of deprecated autosubscribe in 2.5. Choices:
|
|
|
|
Name of the system to register, defaults to the hostname |
|
The type of unit to register, defaults to system |
|
Register with a specific environment in the destination org. Used with Red Hat Satellite 6.x or Katello |
|
Register the system even if it is already registered Choices:
|
|
Organization ID to use in conjunction with activationkey |
|
access.redhat.com or Sat6 password |
|
Default: “^$” |
|
Default: [] |
|
Set a release version |
|
Specify CDN baseurl |
|
Specify an alternative location for a CA certificate for CDN |
|
Specify an alternative Red Hat Subscription Management or Sat6 server |
|
Enable or disable https server certificate verification when connecting to |
|
Specify the port when registering to the Red Hat Subscription Management or Sat6 server. |
|
Specify the prefix when registering to the Red Hat Subscription Management or Sat6 server. |
|
Specify an HTTP proxy hostname. |
|
Specify a password for HTTP proxy with basic authentication |
|
Specify an HTTP proxy port. |
|
Specify a user for HTTP proxy with basic authentication |
|
whether to register and subscribe ( Choices:
|
|
Set syspurpose attributes in file Default: {} |
|
Syspurpose attribute addons |
|
Syspurpose attribute role |
|
Syspurpose attribute service_level_agreement |
|
When this option is true, then syspurpose attributes are synchronized with RHSM server immediately. When this option is false, then syspurpose attributes will be synchronized with RHSM server by rhsmcertd daemon. Choices:
|
|
Syspurpose attribute usage |
|
access.redhat.com or Sat6 username |
Notes
Note
In order to register a system, subscription-manager requires either a username and password, or an activationkey and an Organization ID.
Since 2.5 values for server_hostname, server_insecure, rhsm_baseurl, server_proxy_hostname, server_proxy_port, server_proxy_user and server_proxy_password are no longer taken from the
/etc/rhsm/rhsm.conf
config file and default to None.
Examples
- name: Register as user (joe_user) with password (somepass) and auto-subscribe to available content.
community.general.redhat_subscription:
state: present
username: joe_user
password: somepass
auto_attach: true
- name: Same as above but subscribe to a specific pool by ID.
community.general.redhat_subscription:
state: present
username: joe_user
password: somepass
pool_ids: 0123456789abcdef0123456789abcdef
- name: Register and subscribe to multiple pools.
community.general.redhat_subscription:
state: present
username: joe_user
password: somepass
pool_ids:
- 0123456789abcdef0123456789abcdef
- 1123456789abcdef0123456789abcdef
- name: Same as above but consume multiple entitlements.
community.general.redhat_subscription:
state: present
username: joe_user
password: somepass
pool_ids:
- 0123456789abcdef0123456789abcdef: 2
- 1123456789abcdef0123456789abcdef: 4
- name: Register and pull existing system data.
community.general.redhat_subscription:
state: present
username: joe_user
password: somepass
consumer_id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
- name: Register with activationkey and consume subscriptions matching Red Hat Enterprise Server or Red Hat Virtualization
community.general.redhat_subscription:
state: present
activationkey: 1-222333444
org_id: 222333444
pool: '^(Red Hat Enterprise Server|Red Hat Virtualization)$'
- name: Update the consumed subscriptions from the previous example (remove Red Hat Virtualization subscription)
community.general.redhat_subscription:
state: present
activationkey: 1-222333444
org_id: 222333444
pool: '^Red Hat Enterprise Server$'
- name: Register as user credentials into given environment (against Red Hat Satellite 6.x), and auto-subscribe.
community.general.redhat_subscription:
state: present
username: joe_user
password: somepass
environment: Library
auto_attach: true
- name: Register as user (joe_user) with password (somepass) and a specific release
community.general.redhat_subscription:
state: present
username: joe_user
password: somepass
release: 7.4
- name: Register as user (joe_user) with password (somepass), set syspurpose attributes and synchronize them with server
community.general.redhat_subscription:
state: present
username: joe_user
password: somepass
auto_attach: true
syspurpose:
usage: "Production"
role: "Red Hat Enterprise Server"
service_level_agreement: "Premium"
addons:
- addon1
- addon2
sync: true
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
List of pool IDs to which system is now subscribed Returned: success Sample: {“8a85f9815ab905d3015ab928c7005de4”: “1”} |
Authors
Barnaby Court (@barnabycourt)