actually make use of option aliases

This commit is contained in:
Seth Foster
2021-05-18 10:43:53 -04:00
parent 54dd24b96b
commit 4add72b9d2
4 changed files with 78 additions and 74 deletions

View File

@@ -38,94 +38,98 @@ plugin_routing:
tower_schedule_rrule: tower_schedule_rrule:
redirect: awx.awx.schedule_rrule redirect: awx.awx.schedule_rrule
modules: modules:
tower_job_list: tower_ad_hoc_command_cancel:
redirect: awx.awx.job_list redirect: awx.awx.ad_hoc_command_cancel
tower_job_launch:
redirect: awx.awx.job_launch
tower_workflow_job_template:
redirect: awx.awx.workflow_job_template
tower_team:
redirect: awx.awx.team
tower_job_wait:
redirect: awx.awx.job_wait
tower_application:
redirect: awx.awx.application
tower_ad_hoc_command_wait: tower_ad_hoc_command_wait:
redirect: awx.awx.ad_hoc_command_wait redirect: awx.awx.ad_hoc_command_wait
tower_ad_hoc_command:
redirect: awx.awx.ad_hoc_command
tower_application:
redirect: awx.awx.application
tower_meta:
redirect: awx.awx.controller_meta
tower_credential_input_source:
redirect: awx.awx.credential_input_source
tower_credential_type:
redirect: awx.awx.credential_type
tower_credential: tower_credential:
redirect: awx.awx.credential redirect: awx.awx.credential
tower_label: tower_execution_environment:
redirect: awx.awx.label redirect: awx.awx.execution_environment
tower_export:
redirect: awx.awx.export
tower_group: tower_group:
redirect: awx.awx.group redirect: awx.awx.group
tower_host: tower_host:
redirect: awx.awx.host redirect: awx.awx.host
tower_schedule: tower_import:
redirect: awx.awx.schedule redirect: awx.awx.import
tower_role:
redirect: awx.awx.role
tower_ad_hoc_command:
redirect: awx.awx.ad_hoc_command
tower_execution_environment:
redirect: awx.awx.execution_environment
tower_inventory_source_update:
redirect: awx.awx.inventory_source_update
tower_instance_group: tower_instance_group:
redirect: awx.awx.instance_group redirect: awx.awx.instance_group
tower_settings: tower_inventory_source_update:
redirect: awx.awx.settings redirect: awx.awx.inventory_source_update
tower_meta:
redirect: awx.awx.controller_meta
tower_export:
redirect: awx.awx.export
tower_ad_hoc_command_cancel:
redirect: awx.awx.ad_hoc_command_cancel
tower_inventory_source: tower_inventory_source:
redirect: awx.awx.inventory_source redirect: awx.awx.inventory_source
tower_user: tower_inventory:
redirect: awx.awx.user redirect: awx.awx.inventory
tower_workflow_launch: tower_job_cancel:
redirect: awx.awx.workflow_launch redirect: awx.awx.job_cancel
tower_project: tower_job_launch:
redirect: awx.awx.project redirect: awx.awx.job_launch
tower_token: tower_job_list:
redirect: awx.awx.token redirect: awx.awx.job_list
tower_credential_type: tower_job_template:
redirect: awx.awx.credential_type redirect: awx.awx.job_template
tower_job_wait:
redirect: awx.awx.job_wait
tower_label:
redirect: awx.awx.label
tower_license: tower_license:
redirect: awx.awx.license redirect: awx.awx.license
tower_project_update:
redirect: awx.awx.project_update
tower_notification_template: tower_notification_template:
redirect: awx.awx.notification_template redirect: awx.awx.notification_template
tower_notification:
redirect: awx.awx.notification_template
tower_organization: tower_organization:
redirect: awx.awx.organization redirect: awx.awx.organization
tower_job_template: tower_project_update:
redirect: awx.awx.job_template redirect: awx.awx.project_update
tower_workflow_job_template_node: tower_project:
redirect: awx.awx.workflow_job_template_node redirect: awx.awx.project
tower_job_cancel:
redirect: awx.awx.job_cancel
tower_import:
redirect: awx.awx.import
tower_credential_input_source:
redirect: awx.awx.credential_input_source
tower_inventory:
redirect: awx.awx.inventory
tower_receive: tower_receive:
redirect: awx.awx.receive redirect: awx.awx.receive
deprecation: deprecation:
removal_date: TBD removal_date: TBD
warning_text: see plugin documentation for details warning_text: see plugin documentation for details
tower_role:
redirect: awx.awx.role
tower_schedule:
redirect: awx.awx.schedule
tower_send: tower_send:
redirect: awx.awx.send redirect: awx.awx.send
deprecation: deprecation:
removal_date: TBD removal_date: TBD
warning_text: see plugin documentation for details warning_text: see plugin documentation for details
tower_settings:
redirect: awx.awx.settings
tower_team:
redirect: awx.awx.team
tower_token:
redirect: awx.awx.token
tower_user:
redirect: awx.awx.user
tower_workflow_approval:
redirect: awx.awx.workflow_approval
tower_workflow_job_template_node:
redirect: awx.awx.workflow_job_template_node
tower_workflow_job_template:
redirect: awx.awx.workflow_job_template
tower_workflow_launch:
redirect: awx.awx.workflow_launch
tower_workflow_node_wait:
redirect: awx.awx.workflow_node_wait
tower_workflow_template: tower_workflow_template:
redirect: awx.awx.workflow_template redirect: awx.awx.workflow_template
deprecation: deprecation:
removal_date: TBD removal_date: TBD
warning_text: see plugin documentation for details warning_text: see plugin documentation for details
tower_notification:
redirect: awx.awx.notification_template

View File

@@ -32,12 +32,12 @@ class ItemNotDefined(Exception):
class ControllerModule(AnsibleModule): class ControllerModule(AnsibleModule):
url = None url = None
AUTH_ARGSPEC = dict( AUTH_ARGSPEC = dict(
controller_host=dict(required=False, fallback=(env_fallback, ['CONTROLLER_HOST', 'TOWER_HOST'])), controller_host=dict(required=False, aliases=['tower_host'], fallback=(env_fallback, ['CONTROLLER_HOST', 'TOWER_HOST'])),
controller_username=dict(required=False, fallback=(env_fallback, ['CONTROLLER_USERNAME', 'TOWER_USERNAME'])), controller_username=dict(required=False, aliases=['tower_username'], fallback=(env_fallback, ['CONTROLLER_USERNAME', 'TOWER_USERNAME'])),
controller_password=dict(no_log=True, required=False, fallback=(env_fallback, ['CONTROLLER_PASSWORD', 'TOWER_PASSWORD'])), controller_password=dict(no_log=True, aliases=['tower_password'], required=False, fallback=(env_fallback, ['CONTROLLER_PASSWORD', 'TOWER_PASSWORD'])),
validate_certs=dict(type='bool', aliases=['tower_verify_ssl'], required=False, fallback=(env_fallback, ['CONTROLLER_VERIFY_SSL', 'TOWER_VERIFY_SSL'])), validate_certs=dict(type='bool', aliases=['tower_verify_ssl'], required=False, fallback=(env_fallback, ['CONTROLLER_VERIFY_SSL', 'TOWER_VERIFY_SSL'])),
controller_oauthtoken=dict(type='raw', no_log=True, required=False, fallback=(env_fallback, ['CONTROLLER_OAUTH_TOKEN', 'TOWER_OAUTH_TOKEN'])), controller_oauthtoken=dict(type='raw', no_log=True, aliases=['tower_oauthtoken'], required=False, fallback=(env_fallback, ['CONTROLLER_OAUTH_TOKEN', 'TOWER_OAUTH_TOKEN'])),
controller_config_file=dict(type='path', required=False, default=None), controller_config_file=dict(type='path', aliases=['tower_config_file'], required=False, default=None),
) )
short_params = { short_params = {
'host': 'controller_host', 'host': 'controller_host',

View File

@@ -103,7 +103,7 @@ EXAMPLES = '''
''' '''
RETURN = ''' RETURN = '''
token: tower_token:
type: dict type: dict
description: An Ansible Fact variable representing a token object which can be used for auth in subsequent modules. See examples for usage. description: An Ansible Fact variable representing a token object which can be used for auth in subsequent modules. See examples for usage.
contains: contains:
@@ -125,7 +125,7 @@ def return_token(module, last_response):
# This method will return the entire token object we got back so that a user has access to the token # This method will return the entire token object we got back so that a user has access to the token
module.json_output['ansible_facts'] = { module.json_output['ansible_facts'] = {
'token': last_response, 'tower_token': last_response,
} }
module.exit_json(**module.json_output) module.exit_json(**module.json_output)

View File

@@ -63,21 +63,21 @@
- name: Validate our token works by token - name: Validate our token works by token
job_list: job_list:
oauthtoken: "{{ token.token }}" oauthtoken: "{{ tower_token.token }}"
register: job_list register: job_list
- name: Validate out token works by object - name: Validate our token works by object
job_list: job_list:
oauthtoken: "{{ token }}" oauthtoken: "{{ tower_token }}"
register: job_list register: job_list
always: always:
- name: Delete our Token with our own token - name: Delete our Token with our own token
token: token:
existing_token: "{{ token }}" existing_token: "{{ tower_token }}"
oauthtoken: "{{ token }}" oauthtoken: "{{ tower_token }}"
state: absent state: absent
when: token is defined when: tower_token is defined
register: results register: results
- assert: - assert:
@@ -99,10 +99,10 @@
always: always:
- name: Delete the second Token with our own token - name: Delete the second Token with our own token
token: token:
existing_token_id: "{{ token['id'] }}" existing_token_id: "{{ tower_token['id'] }}"
oauthtoken: "{{ token }}" oauthtoken: "{{ tower_token }}"
state: absent state: absent
when: token is defined when: tower_token is defined
register: results register: results
- assert: - assert: