awx.awx.tower – Ansible dynamic inventory plugin for Ansible Tower.
awx.awx.tower – Ansible dynamic inventory plugin for Ansible Tower.
Note
This plugin is part of the awx.awx collection (version 14.1.0).
To install it use: ansible-galaxy collection install awx.awx
.
To use it in a playbook, specify: awx.awx.tower
.
Synopsis
- Reads inventories from Ansible Tower.
- Supports reading configuration from both YAML config file and environment variables.
- If reading from the YAML file, the file name must end with tower.(yml|yaml) or tower_inventory.(yml|yaml), the path in the command would be /path/to/tower_inventory.(yml|yaml). If some arguments in the config file are missing, this plugin will try to fill in missing arguments by reading from environment variables.
- If reading configurations from environment variables, the path in the command must be @tower_inventory.
Parameters
Parameter | Choices/Defaults | Configuration | Comments |
---|---|---|---|
host string |
env:TOWER_HOST |
The network address of your Ansible Tower host. | |
include_metadata boolean |
|
Make extra requests to provide all group vars with metadata about the source Ansible Tower host. | |
inventory_id raw / required |
env:TOWER_INVENTORY |
The ID of the Ansible Tower inventory that you wish to import. This is allowed to be either the inventory primary key or its named URL slug. Primary key values will be accepted as strings or integers, and URL slugs must be strings. Named URL slugs follow the syntax of "inventory_name++organization_name". | |
oauth_token string |
env:TOWER_OAUTH_TOKEN |
The Tower OAuth token to use. | |
password string |
env:TOWER_PASSWORD |
The password for your Ansible Tower user. | |
username string |
env:TOWER_USERNAME |
The user that you plan to use to access inventories on Ansible Tower. | |
verify_ssl boolean |
|
env:TOWER_VERIFY_SSL |
Specify whether Ansible should verify the SSL certificate of Ansible Tower host. Defaults to True, but this is handled by the shared module_utils code
|
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
# Before you execute the following commands, you should make sure this file is in your plugin path,
# and you enabled this plugin.
# Example for using tower_inventory.yml file
plugin: awx.awx.tower
host: your_ansible_tower_server_network_address
username: your_ansible_tower_username
password: your_ansible_tower_password
inventory_id: the_ID_of_targeted_ansible_tower_inventory
# Then you can run the following command.
# If some of the arguments are missing, Ansible will attempt to read them from environment variables.
# ansible-inventory -i /path/to/tower_inventory.yml --list
# Example for reading from environment variables:
# Set environment variables:
# export TOWER_HOST=YOUR_TOWER_HOST_ADDRESS
# export TOWER_USERNAME=YOUR_TOWER_USERNAME
# export TOWER_PASSWORD=YOUR_TOWER_PASSWORD
# export TOWER_INVENTORY=THE_ID_OF_TARGETED_INVENTORY
# Read the inventory specified in TOWER_INVENTORY from Ansible Tower, and list them.
# The inventory path must always be @tower_inventory if you are reading all settings from environment variables.
# ansible-inventory -i @tower_inventory --list
Authors
- Matthew Jones (@matburt)
- Yunfan Zhang (@YunfanZhang42)
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/awx/awx/tower_inventory.html