restore tower_legacy.py, update examples to include CONTROLLER_HOST

This commit is contained in:
Seth Foster
2021-05-11 20:15:54 -04:00
parent a7b29f6112
commit 1a2e56c785
3 changed files with 22 additions and 22 deletions

View File

@@ -10,28 +10,28 @@ __metaclass__ = type
class ModuleDocFragment(object): class ModuleDocFragment(object):
# Automation Platform Controller documentation fragment # Ansible Tower documentation fragment
DOCUMENTATION = r''' DOCUMENTATION = r'''
options: options:
tower_host: tower_host:
description: description:
- URL to your Automation Platform Controller instance. - URL to your Tower or AWX instance.
- If value not set, will try environment variable C(TOWER_HOST) and then config files - If value not set, will try environment variable C(TOWER_HOST) and then config files
- If value not specified by any means, the value of C(127.0.0.1) will be used - If value not specified by any means, the value of C(127.0.0.1) will be used
type: str type: str
tower_username: tower_username:
description: description:
- Username for your controller instance. - Username for your Tower or AWX instance.
- If value not set, will try environment variable C(TOWER_USERNAME) and then config files - If value not set, will try environment variable C(TOWER_USERNAME) and then config files
type: str type: str
tower_password: tower_password:
description: description:
- Password for your controller instance. - Password for your Tower or AWX instance.
- If value not set, will try environment variable C(TOWER_PASSWORD) and then config files - If value not set, will try environment variable C(TOWER_PASSWORD) and then config files
type: str type: str
validate_certs: validate_certs:
description: description:
- Whether to allow insecure connections. - Whether to allow insecure connections to Tower or AWX.
- If C(no), SSL certificates will not be validated. - If C(no), SSL certificates will not be validated.
- This should only be used on personally controlled sites using self-signed certificates. - This should only be used on personally controlled sites using self-signed certificates.
- If value not set, will try environment variable C(TOWER_VERIFY_SSL) and then config files - If value not set, will try environment variable C(TOWER_VERIFY_SSL) and then config files
@@ -39,14 +39,14 @@ options:
aliases: [ tower_verify_ssl ] aliases: [ tower_verify_ssl ]
tower_config_file: tower_config_file:
description: description:
- Path to the controller config file. - Path to the Tower or AWX config file.
- If provided, the other locations for config files will not be considered. - If provided, the other locations for config files will not be considered.
type: path type: path
notes: notes:
- If no I(config_file) is provided we will attempt to use the tower-cli library - If no I(config_file) is provided we will attempt to use the tower-cli library
defaults to find your host information. defaults to find your Tower host information.
- I(config_file) should be in the following format - I(config_file) should contain Tower configuration in the following format
host=hostname host=hostname
username=username username=username
password=password password=password

View File

@@ -15,10 +15,10 @@ short_description: Ansible dynamic inventory plugin for the Automation Platform
description: description:
- Reads inventories from the Automation Platform Controller. - Reads inventories from the Automation Platform Controller.
- Supports reading configuration from both YAML config file and environment variables. - 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), - If reading from the YAML file, the file name must end with controller.(yml|yaml) or controller_inventory.(yml|yaml),
the path in the command would be /path/to/tower_inventory.(yml|yaml). If some arguments in the config file the path in the command would be /path/to/controller_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. 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. - If reading configurations from environment variables, the path in the command must be @controller_inventory.
extends_documentation_fragment: awx.awx.auth_plugin extends_documentation_fragment: awx.awx.auth_plugin
options: options:
inventory_id: inventory_id:
@@ -29,7 +29,7 @@ options:
- Named URL slugs follow the syntax of "inventory_name++organization_name". - Named URL slugs follow the syntax of "inventory_name++organization_name".
type: raw type: raw
env: env:
- name: TOWER_INVENTORY - name: CONTROLLER_INVENTORY
required: True required: True
include_metadata: include_metadata:
description: Make extra requests to provide all group vars with metadata about the source host. description: Make extra requests to provide all group vars with metadata about the source host.
@@ -41,7 +41,7 @@ EXAMPLES = '''
# Before you execute the following commands, you should make sure this file is in your plugin path, # Before you execute the following commands, you should make sure this file is in your plugin path,
# and you enabled this plugin. # and you enabled this plugin.
# Example for using tower_inventory.yml file # Example for using controller_inventory.yml file
plugin: awx.awx.controller plugin: awx.awx.controller
host: your_automation_controller_server_network_address host: your_automation_controller_server_network_address
@@ -50,18 +50,18 @@ password: your_automation_controller_password
inventory_id: the_ID_of_targeted_automation_controller_inventory inventory_id: the_ID_of_targeted_automation_controller_inventory
# Then you can run the following command. # Then you can run the following command.
# If some of the arguments are missing, Ansible will attempt to read them from environment variables. # 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 # ansible-inventory -i /path/to/controller_inventory.yml --list
# Example for reading from environment variables: # Example for reading from environment variables:
# Set environment variables: # Set environment variables:
# export TOWER_HOST=YOUR_TOWER_HOST_ADDRESS # export CONTROLLER_HOST=YOUR_AUTOMATION_PLATFORM_CONTROLLER_HOST_ADDRESS
# export TOWER_USERNAME=YOUR_TOWER_USERNAME # export CONTROLLER_USERNAME=YOUR_CONTROLLER_USERNAME
# export TOWER_PASSWORD=YOUR_TOWER_PASSWORD # export CONTROLLER_PASSWORD=YOUR_CONTROLLER_PASSWORD
# export TOWER_INVENTORY=THE_ID_OF_TARGETED_INVENTORY # export CONTROLLER_INVENTORY=THE_ID_OF_TARGETED_INVENTORY
# Read the inventory specified in TOWER_INVENTORY from the controller, and list them. # Read the inventory specified in CONTROLLER_INVENTORY from the controller, and list them.
# The inventory path must always be @tower_inventory if you are reading all settings from environment variables. # The inventory path must always be @controller_inventory if you are reading all settings from environment variables.
# ansible-inventory -i @tower_inventory --list # ansible-inventory -i @controller_inventory --list
''' '''
import os import os

View File

@@ -83,7 +83,7 @@ def tower_auth_config(module):
def tower_check_mode(module): def tower_check_mode(module):
'''Execute check mode logic for Automation Platform Controller modules''' '''Execute check mode logic for Ansible Tower modules'''
if module.check_mode: if module.check_mode:
try: try:
result = client.get('/ping').json() result = client.get('/ping').json()