redhat_subscription – Manage registration and subscriptions to RHSM using the subscription-manager command¶
Synopsis¶
Manage registration and subscription to the Red Hat Subscription Management entitlement platform using the
subscription-managercommand
Requirements¶
The below requirements are needed on the host that executes this module.
subscription-manager
Parameters¶
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.confconfig file and default to None.
Examples¶
- name: Register as user (joe_user) with password (somepass) and auto-subscribe to available content.
  redhat_subscription:
    state: present
    username: joe_user
    password: somepass
    auto_attach: true
- name: Same as above but subscribe to a specific pool by ID.
  redhat_subscription:
    state: present
    username: joe_user
    password: somepass
    pool_ids: 0123456789abcdef0123456789abcdef
- name: Register and subscribe to multiple pools.
  redhat_subscription:
    state: present
    username: joe_user
    password: somepass
    pool_ids:
      - 0123456789abcdef0123456789abcdef
      - 1123456789abcdef0123456789abcdef
- name: Same as above but consume multiple entitlements.
  redhat_subscription:
    state: present
    username: joe_user
    password: somepass
    pool_ids:
      - 0123456789abcdef0123456789abcdef: 2
      - 1123456789abcdef0123456789abcdef: 4
- name: Register and pull existing system data.
  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
  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)
  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.
  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
  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
  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 | Returned | Description | 
|---|---|---|
| 
                
                subscribed_pool_ids
                
                 
                  complex
                                       
                                 | 
            success | 
                                         List of pool IDs to which system is now subscribed 
                                    Sample: 
                                            {'8a85f9815ab905d3015ab928c7005de4': '1'} 
                                 | 
        
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Community. [community]
Authors¶
Barnaby Court (@barnabycourt)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.