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
No known key found for this signature in database
GPG Key ID: 86E90D96F7184028
3 changed files with 22 additions and 22 deletions

View File

@ -10,28 +10,28 @@ __metaclass__ = type
class ModuleDocFragment(object):
# Automation Platform Controller documentation fragment
# Ansible Tower documentation fragment
DOCUMENTATION = r'''
options:
tower_host:
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 specified by any means, the value of C(127.0.0.1) will be used
type: str
tower_username:
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
type: str
tower_password:
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
type: str
validate_certs:
description:
- Whether to allow insecure connections.
- Whether to allow insecure connections to Tower or 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(TOWER_VERIFY_SSL) and then config files
@ -39,14 +39,14 @@ options:
aliases: [ tower_verify_ssl ]
tower_config_file:
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.
type: path
notes:
- If no I(config_file) is provided we will attempt to use the tower-cli library
defaults to find your host information.
- I(config_file) should be in the following format
defaults to find your Tower host information.
- I(config_file) should contain Tower configuration in the following format
host=hostname
username=username
password=password

View File

@ -15,10 +15,10 @@ short_description: Ansible dynamic inventory plugin for the Automation Platform
description:
- Reads inventories from the Automation Platform Controller.
- 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
- 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/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.
- 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
options:
inventory_id:
@ -29,7 +29,7 @@ options:
- Named URL slugs follow the syntax of "inventory_name++organization_name".
type: raw
env:
- name: TOWER_INVENTORY
- name: CONTROLLER_INVENTORY
required: True
include_metadata:
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,
# and you enabled this plugin.
# Example for using tower_inventory.yml file
# Example for using controller_inventory.yml file
plugin: awx.awx.controller
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
# 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
# ansible-inventory -i /path/to/controller_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 the controller, 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
# export CONTROLLER_HOST=YOUR_AUTOMATION_PLATFORM_CONTROLLER_HOST_ADDRESS
# export CONTROLLER_USERNAME=YOUR_CONTROLLER_USERNAME
# export CONTROLLER_PASSWORD=YOUR_CONTROLLER_PASSWORD
# export CONTROLLER_INVENTORY=THE_ID_OF_TARGETED_INVENTORY
# Read the inventory specified in CONTROLLER_INVENTORY from the controller, and list them.
# The inventory path must always be @controller_inventory if you are reading all settings from environment variables.
# ansible-inventory -i @controller_inventory --list
'''
import os

View File

@ -83,7 +83,7 @@ def tower_auth_config(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:
try:
result = client.get('/ping').json()