redhat_cop.ah_configuration.ah_token (0.9.2) — module

create, update, or destroy Automation Hub tokens.

| "added in version" 2.10 of redhat_cop.ah_configuration"

Authors: John Westcott IV (@john-westcott-iv), Sean Sullivan (@sean-m-sullivan)

preview | supported by community

Install collection

Install with ansible-galaxy collection install redhat_cop.ah_configuration:==0.9.2


Add to requirements.yml

  collections:
    - name: redhat_cop.ah_configuration
      version: 0.9.2

Description

Create or destroy Automation Hub tokens. See U(https://www.ansible.com/tower) for an overview.

In addition, the module sets an Ansible fact which can be passed into other ah_* modules as the parameter ah_oauthtoken. See examples for usage.

Because of the sensitive nature of tokens, the created token value is only available once through the Ansible fact. (See RETURN for details)

Due to the nature of tokens in Automation Hub this module is not idempotent. A second will with the same parameters will create a new token.

If you are creating a temporary token for use with modules you should delete the token when you are done with it. See the example for how to do it.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a new token using an existing token
  ah_token:
    ah_token: "{{ my_existing_token }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete this token
  ah_token:
    ah_token: "{{ ah_token }}"
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a new token using username/password
  ah_token:
    state: present
    ah_username: "{{ my_username }}"
    ah_password: "{{ my_password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Use our new token to make another call
  namespace:
    ah_token: "{{ ah_token }}"

Inputs

    
state:
    choices:
    - present
    - absent
    default: present
    description:
    - Desired state of the resource.
    type: str

ah_host:
    aliases:
    - ah_hostname
    description:
    - URL to Ansible Galaxy or Automation Hub instance.
    - If value not set, will try environment variable C(AH_HOST)
    - If value not specified by any means, the value of C(127.0.0.1) will be used
    type: str

ah_token:
    description:
    - The Ansible Galaxy or Automation Hub API token to use.
    - This value can be in one of two formats.
    - A string which is the token itself. (i.e. bqV5txm97wqJqtkxlMkhQz0pKhRMMX)
    - A dictionary structure as returned by the ah_token module.
    - If value not set, will try environment variable C(AH_API_TOKEN)
    type: raw

ah_password:
    description:
    - Password for your Ansible Galaxy or Automation Hub instance.
    - If value not set, will try environment variable C(AH_PASSWORD)
    type: str

ah_username:
    description:
    - Username for your Ansible Galaxy or Automation Hub instance.
    - If value not set, will try environment variable C(AH_USERNAME)
    type: str

ah_path_prefix:
    default: galaxy
    description:
    - API path used to access the api.
    - For galaxy_ng this is either 'automation-hub' or the custom prefix used on install
      with GALAXY_API_PATH_PREFIX
    - For Automation Hub this is 'galaxy'
    type: str

validate_certs:
    aliases:
    - ah_verify_ssl
    description:
    - Whether to allow insecure connections to Galaxy or Automation Hub Server.
    - If C(no), SSL certificates will not be validated.
    - This should only be used on personally controlled sites using self-signed certificates.
    - If value not set, will try environment variable C(AH_VERIFY_SSL)
    type: bool

Outputs

ah_token:
  contains:
    id:
      description: The numeric ID of the token created
      type: str
    token:
      description: The token that was generated. This token can never be accessed
        again, make sure this value is noted before it is lost.
      type: str
  description: An Ansible Fact variable representing a Tower token object which can
    be used for auth in subsequent modules. See examples for usage.
  returned: on successful create
  type: dict