ansible.builtin.tower_credential (v2.9.24) — module

create, update, or destroy Ansible Tower credential.

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

Authors: Wayne Witzel III (@wwitzel3)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.24

Description

Create, update, or destroy Ansible Tower credentials. See U(https://www.ansible.com/tower) for an overview.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add tower credential
  tower_credential:
    name: Team Name
    description: Team Description
    organization: test-org
    kind: ssh
    state: present
    tower_config_file: "~/tower_cli.cfg"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a valid SCM credential from a private_key file
  tower_credential:
    name: SCM Credential
    organization: Default
    state: present
    kind: scm
    username: joe
    password: secret
    ssh_key_data: "{{ lookup('file', '/tmp/id_rsa') }}"
    ssh_key_unlock: "passphrase"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Fetch private key
  slurp:
    src: '$HOME/.ssh/aws-private.pem'
  register: aws_ssh_key
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add Credential Into Tower
  tower_credential:
    name: Workshop Credential
    ssh_key_data: "{{ aws_ssh_key['content'] | b64decode }}"
    kind: ssh
    organization: Default
    tower_username: admin
    tower_password: ansible
    tower_host: https://localhost
  run_once: true
  delegate_to: localhost

Inputs

    
host:
    description:
    - Host for this credential.
    type: str

kind:
    choices:
    - ssh
    - vault
    - net
    - scm
    - aws
    - vmware
    - satellite6
    - cloudforms
    - gce
    - azure_rm
    - openstack
    - rhv
    - insights
    - tower
    description:
    - Type of credential being added.
    - The ssh choice refers to a Tower Machine credential.
    required: true
    type: str

name:
    description:
    - The name to use for the credential.
    required: true
    type: str

team:
    description:
    - Team that should own this credential.
    type: str

user:
    description:
    - User that should own this credential.
    type: str

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

client:
    description:
    - Client or application ID for azure_rm type.
    type: str

domain:
    description:
    - Domain for openstack type.
    type: str

secret:
    description:
    - Secret token for azure_rm type.
    type: str

tenant:
    description:
    - Tenant ID for azure_rm type.
    type: str

project:
    description:
    - Project that should for this credential.
    type: str

password:
    description:
    - Password for this credential. ``secret_key`` for AWS. ``api_key`` for RAX.
    - Use "ASK" and launch in Tower to be prompted.
    type: str

username:
    description:
    - Username for this credential. ``access_key`` for AWS.
    type: str

vault_id:
    description:
    - Vault identifier.
    - This parameter is only valid if C(kind) is specified as C(vault).
    type: str
    version_added: '2.8'
    version_added_collection: ansible.builtin

authorize:
    default: 'no'
    description:
    - Should use authorize for net type.
    type: bool

description:
    description:
    - The description to use for the credential.
    type: str

organization:
    description:
    - Organization that should own the credential.
    required: true
    type: str

ssh_key_data:
    description:
    - SSH private key content. To extract the content from a file path, use the lookup
      function (see examples).
    required: false
    type: str

subscription:
    description:
    - Subscription ID for azure_rm type.
    type: str

become_method:
    choices:
    - None
    - sudo
    - su
    - pbrun
    - pfexec
    - pmrun
    description:
    - Become method to use for privilege escalation.
    type: str

security_token:
    description:
    - STS token for aws type.
    type: str
    version_added: '2.6'
    version_added_collection: ansible.builtin

ssh_key_unlock:
    description:
    - Unlock password for ssh_key.
    - Use "ASK" and launch in Tower to be prompted.
    type: str

validate_certs:
    aliases:
    - tower_verify_ssl
    description:
    - Whether to allow insecure connections to AWX.
    - 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(CONTROLLER_VERIFY_SSL) and then
      config files
    type: bool

vault_password:
    description:
    - Vault password.
    - Use "ASK" and launch in Tower to be prompted.
    type: str

become_password:
    description:
    - Become password.
    - Use "ASK" and launch in Tower to be prompted.
    type: str

become_username:
    description:
    - Become username.
    - Use "ASK" and launch in Tower to be prompted.
    type: str

controller_host:
    aliases:
    - tower_host
    description:
    - URL to your Automation Platform Controller instance.
    - If value not set, will try environment variable C(CONTROLLER_HOST) and then config
      files
    - If value not specified by any means, the value of C(127.0.0.1) will be used
    type: str

authorize_password:
    description:
    - Password for net credentials that require authorize.
    type: str

controller_password:
    aliases:
    - tower_password
    description:
    - Password for your controller instance.
    - If value not set, will try environment variable C(CONTROLLER_PASSWORD) and then
      config files
    type: str

controller_username:
    aliases:
    - tower_username
    description:
    - Username for your controller instance.
    - If value not set, will try environment variable C(CONTROLLER_USERNAME) and then
      config files
    type: str

controller_oauthtoken:
    aliases:
    - tower_oauthtoken
    description:
    - The OAuth 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 token module.
    - If value not set, will try environment variable C(CONTROLLER_OAUTH_TOKEN) and then
      config files
    type: raw
    version_added: 3.7.0
    version_added_collection: awx.awx

controller_config_file:
    aliases:
    - tower_config_file
    description:
    - Path to the controller config file.
    - If provided, the other locations for config files will not be considered.
    type: path