` for details.
    To use it in a playbook, specify: :code:`theforeman.foreman.activation_key`.
.. version_added
.. rst-class:: ansible-version-added
New in theforeman.foreman 1.0.0
.. contents::
   :local:
   :depth: 1
.. Deprecated
Synopsis
--------
.. Description
- Create and manage activation keys
.. Aliases
Aliases: katello_activation_key
.. Requirements
.. _ansible_collections.theforeman.foreman.activation_key_module_requirements:
Requirements
------------
The below requirements are needed on the host that executes this module.
- requests
.. Options
Parameters
----------
.. tabularcolumns:: \X{1}{3}\X{2}{3}
.. list-table::
  :width: 100%
  :widths: auto
  :header-rows: 1
  :class: longtable ansible-option-table
  * - Parameter
    - Comments
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-auto_attach:
      .. rst-class:: ansible-option-title
      **auto_attach**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`boolean`
      .. raw:: html
        
 
    - .. raw:: html
        
      Set Auto\-Attach on or off
      .. rst-class:: ansible-option-line
      :ansible-option-choices:`Choices:`
      - :ansible-option-choices-entry:`false`
      - :ansible-option-choices-entry:`true`
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-ca_path:
      .. rst-class:: ansible-option-title
      **ca_path**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`path`
      .. raw:: html
        
 
    - .. raw:: html
        
      PEM formatted file that contains a CA certificate to be used for validation.
      If the value is not specified in the task, the value of environment variable :literal:`FOREMAN\_CA\_PATH` will be used instead.
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-content_overrides:
      .. rst-class:: ansible-option-title
      **content_overrides**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary`
      .. raw:: html
        
 
    - .. raw:: html
        
      List of content overrides that include label and override state
      Label refers to repository :literal:`content\_label`.
      For Red Hat products for example :literal:`rhel\-7\-server\-rpms`.
      For custom products it's in the format :literal:`\
\_\\_\`\ , e.g. :literal:`ExampleOrg\_ExampleProduct\_ExampleRepository`.
      Override state ('enabled', 'disabled', or 'default') sets initial state of repository for newly registered hosts
      .. raw:: html
         
  * - .. raw:: html
        
        
      .. raw:: latex
        \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-content_overrides/label:
      .. rst-class:: ansible-option-title
      **label**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string` / :ansible-option-required:`required`
      .. raw:: html
        
 
      .. raw:: latex
        \end{minipage}
    - .. raw:: html
        
      Repository :literal:`content\_label` to override when registering hosts with the activation key
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. raw:: latex
        \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-content_overrides/override:
      .. rst-class:: ansible-option-title
      **override**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string` / :ansible-option-required:`required`
      .. raw:: html
        
 
      .. raw:: latex
        \end{minipage}
    - .. raw:: html
        
      Override value to use for the repository when registering hosts with the activation key
      .. rst-class:: ansible-option-line
      :ansible-option-choices:`Choices:`
      - :ansible-option-choices-entry:`"enabled"`
      - :ansible-option-choices-entry:`"disabled"`
      - :ansible-option-choices-entry:`"default"`
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-content_view:
      .. rst-class:: ansible-option-title
      **content_view**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string`
      .. raw:: html
        
 
    - .. raw:: html
        
      Name of the content view
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-description:
      .. rst-class:: ansible-option-title
      **description**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string`
      .. raw:: html
        
 
    - .. raw:: html
        
      Description of the activation key
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-host_collections:
      .. rst-class:: ansible-option-title
      **host_collections**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`list` / :ansible-option-elements:`elements=string`
      .. raw:: html
        
 
    - .. raw:: html
        
      List of host collections to add to activation key
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-lifecycle_environment:
      .. rst-class:: ansible-option-title
      **lifecycle_environment**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string`
      .. raw:: html
        
 
    - .. raw:: html
        
      Name of the lifecycle environment
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-max_hosts:
      .. rst-class:: ansible-option-title
      **max_hosts**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`integer`
      .. raw:: html
        
 
    - .. raw:: html
        
      Maximum number of registered content hosts.
      Required if :emphasis:`unlimited\_hosts=false`
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-name:
      .. rst-class:: ansible-option-title
      **name**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string` / :ansible-option-required:`required`
      .. raw:: html
        
 
    - .. raw:: html
        
      Name of the activation key
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-new_name:
      .. rst-class:: ansible-option-title
      **new_name**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string`
      .. raw:: html
        
 
    - .. raw:: html
        
      Name of the new activation key when state == copied
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-organization:
      .. rst-class:: ansible-option-title
      **organization**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string` / :ansible-option-required:`required`
      .. raw:: html
        
 
    - .. raw:: html
        
      Organization that the entity is in
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-password:
      .. rst-class:: ansible-option-title
      **password**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string`
      .. raw:: html
        
 
    - .. raw:: html
        
      Password of the user accessing the Foreman server.
      If the value is not specified in the task, the value of environment variable :literal:`FOREMAN\_PASSWORD` will be used instead.
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-purpose_addons:
      .. rst-class:: ansible-option-title
      **purpose_addons**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`list` / :ansible-option-elements:`elements=string`
      .. raw:: html
        
 
    - .. raw:: html
        
      Sets the system purpose add\-ons
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-purpose_role:
      .. rst-class:: ansible-option-title
      **purpose_role**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string`
      .. raw:: html
        
 
    - .. raw:: html
        
      Sets the system purpose role
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-purpose_usage:
      .. rst-class:: ansible-option-title
      **purpose_usage**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string`
      .. raw:: html
        
 
    - .. raw:: html
        
      Sets the system purpose usage
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-release_version:
      .. rst-class:: ansible-option-title
      **release_version**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string`
      .. raw:: html
        
 
    - .. raw:: html
        
      Set the content release version
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-server_url:
      .. rst-class:: ansible-option-title
      **server_url**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string` / :ansible-option-required:`required`
      .. raw:: html
        
 
    - .. raw:: html
        
      URL of the Foreman server.
      If the value is not specified in the task, the value of environment variable :literal:`FOREMAN\_SERVER\_URL` will be used instead.
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-service_level:
      .. rst-class:: ansible-option-title
      **service_level**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string`
      .. raw:: html
        
 
    - .. raw:: html
        
      Set the service level
      .. rst-class:: ansible-option-line
      :ansible-option-choices:`Choices:`
      - :ansible-option-choices-entry:`"Self\-Support"`
      - :ansible-option-choices-entry:`"Standard"`
      - :ansible-option-choices-entry:`"Premium"`
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-state:
      .. rst-class:: ansible-option-title
      **state**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string`
      .. raw:: html
        
 
    - .. raw:: html
        
      State of the Activation Key
      If :literal:`copied` the key will be copied to a new one with :emphasis:`new\_name` as the name and all other fields left untouched
      :literal:`present\_with\_defaults` will ensure the entity exists, but won't update existing ones
      .. rst-class:: ansible-option-line
      :ansible-option-choices:`Choices:`
      - :ansible-option-choices-entry-default:`"present"` :ansible-option-choices-default-mark:`← (default)`
      - :ansible-option-choices-entry:`"present\_with\_defaults"`
      - :ansible-option-choices-entry:`"absent"`
      - :ansible-option-choices-entry:`"copied"`
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-subscriptions:
      .. rst-class:: ansible-option-title
      **subscriptions**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary`
      .. raw:: html
        
 
    - .. raw:: html
        
      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.
      This parameter is not supported in SCA mode.
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. raw:: latex
        \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-subscriptions/name:
      .. rst-class:: ansible-option-title
      **name**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string`
      .. raw:: html
        
 
      .. raw:: latex
        \end{minipage}
    - .. raw:: html
        
      Name of the Subscription to be added.
      Mutually exclusive with :emphasis:`pool\_id` and :emphasis:`upstream\_pool\_id`.
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. raw:: latex
        \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-subscriptions/pool_id:
      .. rst-class:: ansible-option-title
      **pool_id**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string`
      .. raw:: html
        
 
      .. raw:: latex
        \end{minipage}
    - .. raw:: html
        
      Pool ID of the Subscription to be added.
      Mutually exclusive with :emphasis:`name` and :emphasis:`upstream\_pool\_id`.
      Also named :literal:`Candlepin Id` in the CSV export of the subscriptions,
      it is as well the :literal:`UUID` as output by :literal:`hammer subscription list`.
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. raw:: latex
        \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-subscriptions/upstream_pool_id:
      .. rst-class:: ansible-option-title
      **upstream_pool_id**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string`
      .. raw:: html
        
 
      .. raw:: latex
        \end{minipage}
    - .. raw:: html
        
      Upstream Pool ID of the Subscription to be added.
      Mutually exclusive with :emphasis:`name` and :emphasis:`pool\_id`.
      Also named :literal:`Master Pools` in the Red Hat Portal.
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-unlimited_hosts:
      .. rst-class:: ansible-option-title
      **unlimited_hosts**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`boolean`
      .. raw:: html
        
 
    - .. raw:: html
        
      Can the activation key have unlimited hosts
      .. rst-class:: ansible-option-line
      :ansible-option-choices:`Choices:`
      - :ansible-option-choices-entry:`false`
      - :ansible-option-choices-entry:`true`
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-use_gssapi:
      .. rst-class:: ansible-option-title
      **use_gssapi**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`boolean`
      .. raw:: html
        
 
    - .. raw:: html
        
      Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication.
      Requires the Python library \ `requests\-gssapi `__ to be installed.
      If the value is not specified in the task, the value of environment variable :literal:`FOREMAN\_USE\_GSSAPI` will be used instead.
      .. rst-class:: ansible-option-line
      :ansible-option-choices:`Choices:`
      - :ansible-option-choices-entry-default:`false` :ansible-option-choices-default-mark:`← (default)`
      - :ansible-option-choices-entry:`true`
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-username:
      .. rst-class:: ansible-option-title
      **username**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`string`
      .. raw:: html
        
 
    - .. raw:: html
        
      Username accessing the Foreman server.
      If the value is not specified in the task, the value of environment variable :literal:`FOREMAN\_USERNAME` will be used instead.
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__parameter-validate_certs:
      .. rst-class:: ansible-option-title
      **validate_certs**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`boolean`
      .. raw:: html
        
 
    - .. raw:: html
        
      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 :literal:`FOREMAN\_VALIDATE\_CERTS` will be used instead.
      .. rst-class:: ansible-option-line
      :ansible-option-choices:`Choices:`
      - :ansible-option-choices-entry:`false`
      - :ansible-option-choices-entry-default:`true` :ansible-option-choices-default-mark:`← (default)`
      .. raw:: html
        
.. Attributes
Attributes
----------
.. tabularcolumns:: \X{2}{10}\X{3}{10}\X{5}{10}
.. list-table::
  :width: 100%
  :widths: auto
  :header-rows: 1
  :class: longtable ansible-option-table
  * - Attribute
    - Support
    - Description
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__attribute-check_mode:
      .. rst-class:: ansible-option-title
      **check_mode**
      .. raw:: html
        
      .. raw:: html
        
 
    - .. raw:: html
        
      :ansible-attribute-support-label:`Support: \ `\ :ansible-attribute-support-full:`full`
      .. raw:: html
        
    - .. raw:: html
        
      Can run in check\_mode and return changed status prediction without modifying the entity
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__attribute-diff_mode:
      .. rst-class:: ansible-option-title
      **diff_mode**
      .. raw:: html
        
      .. raw:: html
        
 
    - .. raw:: html
        
      :ansible-attribute-support-label:`Support: \ `\ :ansible-attribute-support-full:`full`
      .. raw:: html
        
    - .. raw:: html
        
      Will return details on what has changed (or possibly needs changing in check\_mode), when in diff mode
      .. raw:: html
        
.. Notes
.. Seealso
.. Examples
Examples
--------
.. code-block:: yaml+jinja
    - 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
        content_overrides:
          - label: rhel-7-server-rpms
            override: enabled
          - label: ExampleOrganization_ExampleCustomProduct_ExampleRepository
            override: enabled
        auto_attach: false
        release_version: 7Server
        service_level: Standard
.. Facts
.. Return values
Return Values
-------------
Common return values are documented :ref:`here `, the following are the fields unique to this module:
.. tabularcolumns:: \X{1}{3}\X{2}{3}
.. list-table::
  :width: 100%
  :widths: auto
  :header-rows: 1
  :class: longtable ansible-option-table
  * - Key
    - Description
  * - .. raw:: html
        
        
      .. _ansible_collections.theforeman.foreman.activation_key_module__return-entity:
      .. rst-class:: ansible-option-title
      **entity**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`dictionary`
      .. raw:: html
        
 
    - .. raw:: html
        
      Final state of the affected entities grouped by their type.
      .. rst-class:: ansible-option-line
      :ansible-option-returned-bold:`Returned:` success
      .. raw:: html
        
  * - .. raw:: html
        
        
      .. raw:: latex
        \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}
      .. _ansible_collections.theforeman.foreman.activation_key_module__return-entity/activation_keys:
      .. rst-class:: ansible-option-title
      **activation_keys**
      .. raw:: html
        
      .. ansible-option-type-line::
        :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary`
      .. raw:: html
        
 
      .. raw:: latex
        \end{minipage}
    - .. raw:: html
        
      List of activation keys.
      .. rst-class:: ansible-option-line
      :ansible-option-returned-bold:`Returned:` success
      .. raw:: html
        
..  Status (Presently only deprecated)
.. Authors
Authors
~~~~~~~
- Andrew Kofink (@akofink)
.. Extra links
Collection links
~~~~~~~~~~~~~~~~
.. ansible-links::
  - title: "Issue Tracker"
    url: "https://github.com/theforeman/foreman-ansible-modules/issues"
    external: true
  - title: "Homepage"
    url: "https://theforeman.org/"
    external: true
  - title: "Repository (Sources)"
    url: "https://github.com/theforeman/foreman-ansible-modules"
    external: true
.. Parsing errors