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

View File

@ -38,94 +38,98 @@ plugin_routing:
tower_schedule_rrule:
redirect: awx.awx.schedule_rrule
modules:
tower_job_list:
redirect: awx.awx.job_list
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_cancel:
redirect: awx.awx.ad_hoc_command_cancel
tower_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:
redirect: awx.awx.credential
tower_label:
redirect: awx.awx.label
tower_execution_environment:
redirect: awx.awx.execution_environment
tower_export:
redirect: awx.awx.export
tower_group:
redirect: awx.awx.group
tower_host:
redirect: awx.awx.host
tower_schedule:
redirect: awx.awx.schedule
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_import:
redirect: awx.awx.import
tower_instance_group:
redirect: awx.awx.instance_group
tower_settings:
redirect: awx.awx.settings
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_update:
redirect: awx.awx.inventory_source_update
tower_inventory_source:
redirect: awx.awx.inventory_source
tower_user:
redirect: awx.awx.user
tower_workflow_launch:
redirect: awx.awx.workflow_launch
tower_project:
redirect: awx.awx.project
tower_token:
redirect: awx.awx.token
tower_credential_type:
redirect: awx.awx.credential_type
tower_inventory:
redirect: awx.awx.inventory
tower_job_cancel:
redirect: awx.awx.job_cancel
tower_job_launch:
redirect: awx.awx.job_launch
tower_job_list:
redirect: awx.awx.job_list
tower_job_template:
redirect: awx.awx.job_template
tower_job_wait:
redirect: awx.awx.job_wait
tower_label:
redirect: awx.awx.label
tower_license:
redirect: awx.awx.license
tower_project_update:
redirect: awx.awx.project_update
tower_notification_template:
redirect: awx.awx.notification_template
tower_notification:
redirect: awx.awx.notification_template
tower_organization:
redirect: awx.awx.organization
tower_job_template:
redirect: awx.awx.job_template
tower_workflow_job_template_node:
redirect: awx.awx.workflow_job_template_node
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_project_update:
redirect: awx.awx.project_update
tower_project:
redirect: awx.awx.project
tower_receive:
redirect: awx.awx.receive
deprecation:
removal_date: TBD
warning_text: see plugin documentation for details
tower_role:
redirect: awx.awx.role
tower_schedule:
redirect: awx.awx.schedule
tower_send:
redirect: awx.awx.send
deprecation:
removal_date: TBD
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:
redirect: awx.awx.workflow_template
deprecation:
removal_date: TBD
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):
url = None
AUTH_ARGSPEC = dict(
controller_host=dict(required=False, fallback=(env_fallback, ['CONTROLLER_HOST', 'TOWER_HOST'])),
controller_username=dict(required=False, fallback=(env_fallback, ['CONTROLLER_USERNAME', 'TOWER_USERNAME'])),
controller_password=dict(no_log=True, required=False, fallback=(env_fallback, ['CONTROLLER_PASSWORD', 'TOWER_PASSWORD'])),
controller_host=dict(required=False, aliases=['tower_host'], fallback=(env_fallback, ['CONTROLLER_HOST', 'TOWER_HOST'])),
controller_username=dict(required=False, aliases=['tower_username'], fallback=(env_fallback, ['CONTROLLER_USERNAME', 'TOWER_USERNAME'])),
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'])),
controller_oauthtoken=dict(type='raw', no_log=True, required=False, fallback=(env_fallback, ['CONTROLLER_OAUTH_TOKEN', 'TOWER_OAUTH_TOKEN'])),
controller_config_file=dict(type='path', required=False, default=None),
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', aliases=['tower_config_file'], required=False, default=None),
)
short_params = {
'host': 'controller_host',

View File

@ -103,7 +103,7 @@ EXAMPLES = '''
'''
RETURN = '''
token:
tower_token:
type: dict
description: An Ansible Fact variable representing a token object which can be used for auth in subsequent modules. See examples for usage.
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
module.json_output['ansible_facts'] = {
'token': last_response,
'tower_token': last_response,
}
module.exit_json(**module.json_output)

View File

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