awx.awx.tower_token – create, update, or destroy Ansible Tower tokens.¶
Note
This plugin is part of the awx.awx collection (version 17.1.0).
To install it use: ansible-galaxy collection install awx.awx
.
To use it in a playbook, specify: awx.awx.tower_token
.
New in version 2.3: of awx.awx
Synopsis¶
Create or destroy Ansible Tower tokens. See https://www.ansible.com/tower for an overview.
In addition, the module sets an Ansible fact which can be passed into other tower_* modules as the parameter tower_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 Tower 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.
Parameters¶
Notes¶
Note
If no config_file is provided we will attempt to use the tower-cli library defaults to find your Tower host information.
config_file should contain Tower configuration in the following format host=hostname username=username password=password
Examples¶
- block:
- name: Create a new token using an existing token
tower_token:
description: '{{ token_description }}'
scope: "write"
state: present
tower_oauthtoken: "{{ my_existing_token }}"
- name: Delete this token
tower_token:
existing_token: "{{ tower_token }}"
state: absent
- name: Create a new token using username/password
tower_token:
description: '{{ token_description }}'
scope: "write"
state: present
tower_username: "{{ my_username }}"
tower_password: "{{ my_password }}"
- name: Use our new token to make another call
tower_job_list:
tower_oauthtoken: "{{ tower_token }}"
always:
- name: Delete our Token with the token we created
tower_token:
existing_token: "{{ tower_token }}"
state: absent
when: tower_token is defined
- name: Delete a token by its id
tower_token:
existing_token_id: 4
state: absent
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
John Westcott IV (@john-westcott-iv)