theforeman.foreman.activation_key – Manage Activation Keys

Note

This plugin is part of the theforeman.foreman collection (version 1.5.0).

To install it use: ansible-galaxy collection install theforeman.foreman.

To use it in a playbook, specify: theforeman.foreman.activation_key.

New in version 1.0.0: of theforeman.foreman

Synopsis

  • Create and manage activation keys

Requirements

The below requirements are needed on the host that executes this module.

  • requests

Parameters

Parameter Choices/Defaults Comments
auto_attach
boolean
    Choices:
  • no
  • yes
Set Auto-Attach on or off
content_overrides
list / elements=dictionary
List of content overrides that include label and override state ('enabled', 'disabled' or 'default')
label
string / required
Label of the content override
override
string / required
    Choices:
  • enabled
  • disabled
  • default
Override value
content_view
string
Name of the content view
description
string
Description of the activation key
host_collections
list / elements=string
List of host collections to add to activation key
lifecycle_environment
string
Name of the lifecycle environment
max_hosts
integer
Maximum number of registered content hosts.
Required if unlimited_hosts=false
name
string / required
Name of the activation key
new_name
string
Name of the new activation key when state == copied
organization
string / required
Organization that the entity is in
password
string / required
Password of the user accessing the Foreman server.
If the value is not specified in the task, the value of environment variable FOREMAN_PASSWORD will be used instead.
purpose_addons
list / elements=string
Sets the system purpose add-ons
purpose_role
string
Sets the system purpose role
purpose_usage
string
Sets the system purpose usage
release_version
string
Set the content release version
server_url
string / required
URL of the Foreman server.
If the value is not specified in the task, the value of environment variable FOREMAN_SERVER_URL will be used instead.
service_level
string
    Choices:
  • Self-Support
  • Standard
  • Premium
Set the service level
state
string
    Choices:
  • present ←
  • present_with_defaults
  • absent
  • copied
State of the Activation Key
If copied the key will be copied to a new one with new_name as the name and all other fields left untouched
present_with_defaults will ensure the entity exists, but won't update existing ones
subscriptions
list / elements=dictionary
List of subscriptions that include either Name or Pool ID.
Pool IDs are preferred since Names are not unique and the module will fail if it finds more than one subscription with the same name.
name
string
Name of the Subscription to be added.
Mutually exclusive with pool_id.
pool_id
string
Pool ID of the Subscription to be added.
Mutually exclusive with name.
unlimited_hosts
boolean
    Choices:
  • no
  • yes
Can the activation key have unlimited hosts
username
string / required
Username accessing the Foreman server.
If the value is not specified in the task, the value of environment variable FOREMAN_USERNAME will be used instead.
validate_certs
boolean
    Choices:
  • no
  • yes ←
Whether or not to verify the TLS certificates of the Foreman server.
If the value is not specified in the task, the value of environment variable FOREMAN_VALIDATE_CERTS will be used instead.

Examples

- name: "Create client activation key"
  theforeman.foreman.activation_key:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "Clients"
    organization: "Default Organization"
    lifecycle_environment: "Library"
    content_view: 'client content view'
    host_collections:
        - rhel7-servers
        - rhel7-production
    subscriptions:
      - pool_id: "8a88e9826db22df5016dd018abdd029b"
      - pool_id: "8a88e9826db22df5016dd01a23270344"
      - name: "Red Hat Enterprise Linux"
    content_overrides:
        - label: rhel-7-server-optional-rpms
          override: enabled
    auto_attach: False
    release_version: 7Server
    service_level: Standard

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
entity
dictionary
success
Final state of the affected entities grouped by their type.

 
activation_keys
list / elements=dictionary
success
List of activation keys.



Authors

  • Andrew Kofink (@akofink)