theforeman.foreman.activation_key (4.0.0) — module

Manage Activation Keys

| "added in version" 1.0.0 of theforeman.foreman"

Authors: Andrew Kofink (@akofink)

Install collection

Install with ansible-galaxy collection install theforeman.foreman:==4.0.0


Add to requirements.yml

  collections:
    - name: theforeman.foreman
      version: 4.0.0

Description

Create and manage activation keys


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
name:
    description:
    - Name of the activation key
    required: true
    type: str

state:
    choices:
    - present
    - present_with_defaults
    - absent
    - copied
    default: present
    description:
    - State of the Activation Key
    - If C(copied) the key will be copied to a new one with I(new_name) as the name and
      all other fields left untouched
    - C(present_with_defaults) will ensure the entity exists, but won't update existing
      ones
    type: str

new_name:
    description:
    - Name of the new activation key when state == copied
    type: str

password:
    description:
    - Password of the user accessing the Foreman server.
    - If the value is not specified in the task, the value of environment variable C(FOREMAN_PASSWORD)
      will be used instead.
    required: true
    type: str

username:
    description:
    - Username accessing the Foreman server.
    - If the value is not specified in the task, the value of environment variable C(FOREMAN_USERNAME)
      will be used instead.
    required: true
    type: str

max_hosts:
    description:
    - Maximum number of registered content hosts.
    - Required if I(unlimited_hosts=false)
    type: int

server_url:
    description:
    - URL of the Foreman server.
    - If the value is not specified in the task, the value of environment variable C(FOREMAN_SERVER_URL)
      will be used instead.
    required: true
    type: str

auto_attach:
    description:
    - Set Auto-Attach on or off
    type: bool

description:
    description:
    - Description of the activation key
    type: str

content_view:
    description:
    - Name of the content view
    type: str

organization:
    description:
    - Organization that the entity is in
    required: true
    type: str

purpose_role:
    description:
    - Sets the system purpose role
    type: str

purpose_usage:
    description:
    - Sets the system purpose usage
    type: str

service_level:
    choices:
    - Self-Support
    - Standard
    - Premium
    description:
    - Set the service level
    type: str

subscriptions:
    description:
    - List of subscriptions that include either Name, Pool ID, or Upstream Pool ID.
    - Pool IDs are preferred since Names and Upstream Pool IDs are not guaranteed to be
      unique. The module will fail if it finds more than one match.
    elements: dict
    suboptions:
      name:
        description:
        - Name of the Subscription to be added.
        - Mutually exclusive with I(pool_id) and I(upstream_pool_id).
        required: false
        type: str
      pool_id:
        description:
        - Pool ID of the Subscription to be added.
        - Mutually exclusive with I(name) and I(upstream_pool_id).
        - Also named C(Candlepin Id) in the CSV export of the subscriptions,
        - it is as well the C(UUID) as output by C(hammer subscription list).
        required: false
        type: str
      upstream_pool_id:
        description:
        - Upstream Pool ID of the Subscription to be added.
        - Mutually exclusive with I(name) and I(pool_id).
        - Also named C(Master Pools) in the Red Hat Portal.
        required: false
        type: str
    type: list

purpose_addons:
    description:
    - Sets the system purpose add-ons
    elements: str
    type: list

validate_certs:
    default: true
    description:
    - 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 C(FOREMAN_VALIDATE_CERTS)
      will be used instead.
    type: bool

release_version:
    description:
    - Set the content release version
    type: str

unlimited_hosts:
    description:
    - Can the activation key have unlimited hosts
    type: bool

host_collections:
    description:
    - List of host collections to add to activation key
    elements: str
    type: list

content_overrides:
    description:
    - List of content overrides that include label and override state
    - Label refers to repository C(content_label), e.g. rhel-7-server-rpms
    - Override state ('enabled', 'disabled', or 'default') sets initial state of repository
      for newly registered hosts
    elements: dict
    suboptions:
      label:
        description:
        - Repository C(content_label) to override when registering hosts with the activation
          key
        required: true
        type: str
      override:
        choices:
        - enabled
        - disabled
        - default
        description:
        - Override value to use for the repository when registering hosts with the activation
          key
        required: true
        type: str
    type: list

lifecycle_environment:
    description:
    - Name of the lifecycle environment
    type: str

Outputs

entity:
  contains:
    activation_keys:
      description: List of activation keys.
      elements: dict
      type: list
  description: Final state of the affected entities grouped by their type.
  returned: success
  type: dict