ansible.builtin.redhat_subscription (v2.5.12) — module

Manage registration and subscriptions to RHSM using the C(subscription-manager) command

| "added in version" 1.2 of ansible.builtin"

Authors: Barnaby Court (@barnabycourt)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.5.12

Description

Manage registration and subscription to the Red Hat Subscription Management entitlement platform using the C(subscription-manager) command


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Same as above but subscribe to a specific pool by ID.
  redhat_subscription:
    state: present
    username: joe_user
    password: somepass
    pool_ids: 0123456789abcdef0123456789abcdef
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Register and subscribe to multiple pools.
  redhat_subscription:
    state: present
    username: joe_user
    password: somepass
    pool_ids:
      - 0123456789abcdef0123456789abcdef
      - 1123456789abcdef0123456789abcdef
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Same as above but consume multiple entitlements.
  redhat_subscription:
    state: present
    username: joe_user
    password: somepass
    pool_ids:
      - 0123456789abcdef0123456789abcdef: 2
      - 1123456789abcdef0123456789abcdef: 4
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Register and pull existing system data.
  redhat_subscription:
    state: present
    username: joe_user
    password: somepass
    consumer_id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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)$'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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$'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
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).

      '
    required: false

state:
    choices:
    - present
    - absent
    default: present
    description:
    - whether to register and subscribe (C(present)), or unregister (C(absent)) a system
    required: false

org_id:
    default: null
    description:
    - Organization ID to use in conjunction with activationkey
    required: false
    version_added: '2.0'
    version_added_collection: ansible.builtin

password:
    default: null
    description:
    - access.redhat.com or Sat6 password
    required: false

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).

      '
    version_added: '2.4'
    version_added_collection: ansible.builtin

username:
    default: null
    description:
    - access.redhat.com or Sat6  username
    required: false

auto_attach:
    aliases:
    - autosubscribe
    default: false
    description:
    - Upon successful registration, auto-consume available subscriptions
    - Added in favor of depracated autosubscribe in 2.5.
    required: false
    type: bool
    version_added: '2.5'
    version_added_collection: ansible.builtin

consumer_id:
    default: null
    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.

      '
    required: false
    version_added: '2.1'
    version_added_collection: ansible.builtin

environment:
    default: null
    description:
    - Register with a specific environment in the destination org. Used with Red Hat Satellite
      6.x or Katello
    required: false
    version_added: '2.2'
    version_added_collection: ansible.builtin

rhsm_baseurl:
    description:
    - Specify CDN baseurl
    required: false

activationkey:
    default: null
    description:
    - supply an activation key for use with registration
    required: false

consumer_name:
    default: null
    description:
    - Name of the system to register, defaults to the hostname
    required: false
    version_added: '2.1'
    version_added_collection: ansible.builtin

consumer_type:
    default: null
    description:
    - The type of unit to register, defaults to system
    required: false
    version_added: '2.1'
    version_added_collection: ansible.builtin

force_register:
    default: false
    description:
    - Register the system even if it is already registered
    required: false
    version_added: '2.2'
    version_added_collection: ansible.builtin

server_hostname:
    description:
    - Specify an alternative Red Hat Subscription Management or Sat6 server
    required: false

server_insecure:
    description:
    - Enable or disable https server certificate verification when connecting to C(server_hostname)
    required: false

server_proxy_port:
    description:
    - Specify a HTTP proxy port
    required: false
    version_added: '2.4'
    version_added_collection: ansible.builtin

server_proxy_user:
    description:
    - Specify a user for HTTP proxy with basic authentication
    required: false
    version_added: '2.4'
    version_added_collection: ansible.builtin

server_proxy_hostname:
    description:
    - Specify a HTTP proxy hostname
    required: false
    version_added: '2.4'
    version_added_collection: ansible.builtin

server_proxy_password:
    description:
    - Specify a password for HTTP proxy with basic authentication
    required: false
    version_added: '2.4'
    version_added_collection: ansible.builtin

Outputs

subscribed_pool_ids:
  contains:
    8a85f9815ab905d3015ab928c7005de4: '1'
  description: List of pool IDs to which system is now subscribed
  returned: success
  type: complex