From 1a2e56c785d3c1051e3f05bcd4d964ca2359e365 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Tue, 11 May 2021 20:15:54 -0400 Subject: [PATCH] restore tower_legacy.py, update examples to include CONTROLLER_HOST --- .../plugins/doc_fragments/auth_legacy.py | 16 ++++++------ .../plugins/inventory/controller.py | 26 +++++++++---------- .../plugins/module_utils/tower_legacy.py | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/awx_collection/plugins/doc_fragments/auth_legacy.py b/awx_collection/plugins/doc_fragments/auth_legacy.py index 9ce9aab82b..29c91507f2 100644 --- a/awx_collection/plugins/doc_fragments/auth_legacy.py +++ b/awx_collection/plugins/doc_fragments/auth_legacy.py @@ -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 diff --git a/awx_collection/plugins/inventory/controller.py b/awx_collection/plugins/inventory/controller.py index fa5d09cfd2..f5719a579a 100644 --- a/awx_collection/plugins/inventory/controller.py +++ b/awx_collection/plugins/inventory/controller.py @@ -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 diff --git a/awx_collection/plugins/module_utils/tower_legacy.py b/awx_collection/plugins/module_utils/tower_legacy.py index e184ac0f05..faed980a8a 100644 --- a/awx_collection/plugins/module_utils/tower_legacy.py +++ b/awx_collection/plugins/module_utils/tower_legacy.py @@ -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()