community / community.general / 1.3.14 / module / redhat_subscription Manage registration and subscriptions to RHSM using the C(subscription-manager) command Authors: Barnaby Court (@barnabycourt)community.general.redhat_subscription (1.3.14) — module
Install with ansible-galaxy collection install community.general:==1.3.14
collections: - name: community.general version: 1.3.14
Manage registration and subscription to the Red Hat Subscription Management entitlement platform using the C(subscription-manager) command
- 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
pool: default: ^$ description: - 'Specify a subscription pool name to consume. Regular expressions accepted. Use I(pool_ids) instead if possible, as it is much faster. Mutually exclusive with I(pool_ids). ' type: str state: choices: - present - absent default: present description: - whether to register and subscribe (C(present)), or unregister (C(absent)) a system type: str org_id: description: - Organization ID to use in conjunction with activationkey type: str release: description: - Set a release version type: str password: description: - access.redhat.com or Sat6 password type: str pool_ids: default: [] description: - 'Specify subscription pool IDs to consume. Prefer over I(pool) when possible as it is much faster. A pool ID may be specified as a C(string) - just the pool ID (ex. C(0123456789abcdef0123456789abcdef)), or as a C(dict) with the pool ID as the key, and a quantity as the value (ex. C(0123456789abcdef0123456789abcdef: 2). If the quantity is provided, it is used to consume multiple entitlements from a pool (the pool must support this). Mutually exclusive with I(pool). ' elements: raw type: list username: description: - access.redhat.com or Sat6 username type: str syspurpose: default: {} description: - Set syspurpose attributes in file C(/etc/rhsm/syspurpose/syspurpose.json) and synchronize these attributes with RHSM server. Syspurpose attributes help attach the most appropriate subscriptions to the system automatically. When C(syspurpose.json) file already contains some attributes, then new attributes overwrite existing attributes. When some attribute is not listed in the new list of attributes, the existing attribute will be removed from C(syspurpose.json) file. Unknown attributes are ignored. suboptions: addons: description: Syspurpose attribute addons elements: str type: list role: description: Syspurpose attribute role type: str service_level_agreement: description: Syspurpose attribute service_level_agreement type: str sync: default: false description: - 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. type: bool usage: description: Syspurpose attribute usage type: str type: dict auto_attach: aliases: - autosubscribe description: - Upon successful registration, auto-consume available subscriptions - Added in favor of deprecated autosubscribe in 2.5. type: bool consumer_id: description: - 'References an existing consumer ID to resume using a previous registration for this system. If the system''s identity certificate is lost or corrupted, this option allows it to resume using its previous identity and subscriptions. The default is to not specify a consumer ID so a new ID is created. ' type: str environment: description: - Register with a specific environment in the destination org. Used with Red Hat Satellite 6.x or Katello type: str rhsm_baseurl: description: - Specify CDN baseurl type: str activationkey: description: - supply an activation key for use with registration type: str consumer_name: description: - Name of the system to register, defaults to the hostname type: str consumer_type: description: - The type of unit to register, defaults to system type: str force_register: default: false description: - Register the system even if it is already registered type: bool server_hostname: description: - Specify an alternative Red Hat Subscription Management or Sat6 server type: str server_insecure: description: - Enable or disable https server certificate verification when connecting to C(server_hostname) type: str rhsm_repo_ca_cert: description: - Specify an alternative location for a CA certificate for CDN type: str server_proxy_port: description: - Specify a HTTP proxy port type: str server_proxy_user: description: - Specify a user for HTTP proxy with basic authentication type: str server_proxy_hostname: description: - Specify a HTTP proxy hostname type: str server_proxy_password: description: - Specify a password for HTTP proxy with basic authentication type: str
subscribed_pool_ids: description: List of pool IDs to which system is now subscribed returned: success sample: 8a85f9815ab905d3015ab928c7005de4: '1' type: complex