diff --git a/changelogs/fragments/argument_vars.yml b/changelogs/fragments/argument_vars.yml new file mode 100644 index 0000000..4a2fba8 --- /dev/null +++ b/changelogs/fragments/argument_vars.yml @@ -0,0 +1,4 @@ +--- +minor_changes: + - added additional options for authentication to match controller credential type updates. +... diff --git a/plugins/doc_fragments/auth.py b/plugins/doc_fragments/auth.py index 01b53f6..2759fd4 100644 --- a/plugins/doc_fragments/auth.py +++ b/plugins/doc_fragments/auth.py @@ -16,41 +16,46 @@ class ModuleDocFragment: ah_host: description: - URL to Ansible Automation Hub instance. - - If value not set, will try environment variable E(AH_HOST). + - If value not set, will try environment variable E(AH_HOST), or E(AAP_HOSTNAME). - If value not specified by any means, the value of C(127.0.0.1) will be used. type: str - aliases: [ ah_hostname ] + aliases: [ ah_hostname, aap_hostname ] ah_username: description: - Username for your Ansible Automation Hub instance. - - If value not set, will try environment variable E(AH_USERNAME). + - If value not set, will try environment variable E(AH_USERNAME), or E(AAP_USERNAME). type: str + aliases: [ aap_username ] ah_password: description: - Password for your Ansible Automation Hub instance. - - If value not set, will try environment variable E(AH_PASSWORD). + - If value not set, will try environment variable E(AH_PASSWORD), or E(AAP_PASSWORD). type: str + aliases: [ aap_password ] ah_token: description: - The Ansible Automation Hub API token to use. - This value can be in one of two formats. - A string which is the token itself. (for example, bqV5txm97wqJqtkxlMkhQz0pKhRMMX) - A dictionary structure as returned by the ah_token module. - - If value not set, will try environment variable E(AH_API_TOKEN). + - If value not set, will try environment variable E(AH_API_TOKEN), or E(AAP_TOKEN). type: raw + aliases: [ aap_token ] validate_certs: description: - Whether to allow insecure connections to Automation Hub Server. - If V(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 E(AH_VERIFY_SSL). + - If value not set, will try environment variable E(AH_VERIFY_SSL), or E(AAP_VALIDATE_CERTS). type: bool - aliases: [ ah_verify_ssl ] + aliases: [ ah_verify_ssl, aap_validate_certs ] request_timeout: description: - Specify the timeout Ansible should use in requests to the Automation Hub host. - Defaults to 10 seconds, but this is handled by the shared module_utils code. + - If value not set, will try environment variable E(AAP_REQUEST_TIMEOUT) type: float + aliases: [ aap_request_timeout ] ah_path_prefix: description: - API path used to access the api. diff --git a/plugins/module_utils/ah_api_module.py b/plugins/module_utils/ah_api_module.py index a7a8881..c421430 100644 --- a/plugins/module_utils/ah_api_module.py +++ b/plugins/module_utils/ah_api_module.py @@ -46,11 +46,18 @@ class AHAPIModule(AnsibleModule): AUTH_ARGSPEC = dict( ah_host=dict( required=False, - aliases=["ah_hostname"], - fallback=(env_fallback, ["AH_HOST"]), + aliases=["ah_hostname", "aap_hostname"], + fallback=(env_fallback, ["AH_HOST", "AAP_HOSTNAME"]), ), - ah_username=dict(required=False, fallback=(env_fallback, ["AH_USERNAME"])), - ah_password=dict(no_log=True, required=False, fallback=(env_fallback, ["AH_PASSWORD"])), + ah_username=dict( + required=False, + aliases=["aap_username"], + fallback=(env_fallback, ["AH_USERNAME", "AAP_USERNAME"])), + ah_password=dict( + no_log=True, + required=False, + aliases=["aap_password"], + fallback=(env_fallback, ["AH_PASSWORD", "AAP_PASSWORD"])), ah_path_prefix=dict( required=False, default="galaxy", @@ -58,14 +65,15 @@ class AHAPIModule(AnsibleModule): ), validate_certs=dict( type="bool", - aliases=["ah_verify_ssl"], + aliases=["ah_verify_ssl", "aap_validate_certs"], required=False, - fallback=(env_fallback, ["AH_VERIFY_SSL"]), + fallback=(env_fallback, ["AH_VERIFY_SSL", "AAP_VALIDATE_CERTS"]), ), request_timeout=dict( type="float", + aliases=["aap_request_timeout"], required=False, - fallback=(env_fallback, ["AH_REQUEST_TIMEOUT"]) + fallback=(env_fallback, ["AH_REQUEST_TIMEOUT", "AAP_REQUEST_TIMEOUT"]) ), ) short_params = { diff --git a/plugins/module_utils/ah_module.py b/plugins/module_utils/ah_module.py index 4479ec0..2c4d913 100644 --- a/plugins/module_utils/ah_module.py +++ b/plugins/module_utils/ah_module.py @@ -35,11 +35,18 @@ class AHModule(AnsibleModule): AUTH_ARGSPEC = dict( ah_host=dict( required=False, - aliases=["ah_hostname"], - fallback=(env_fallback, ["AH_HOST"]), + aliases=["ah_hostname", "aap_hostname"], + fallback=(env_fallback, ["AH_HOST", "AAP_HOSTNAME"]), ), - ah_username=dict(required=False, fallback=(env_fallback, ["AH_USERNAME"])), - ah_password=dict(no_log=True, required=False, fallback=(env_fallback, ["AH_PASSWORD"])), + ah_username=dict( + required=False, + aliases=["aap_username"], + fallback=(env_fallback, ["AH_USERNAME", "AAP_USERNAME"])), + ah_password=dict( + no_log=True, + required=False, + aliases=["aap_password"], + fallback=(env_fallback, ["AH_PASSWORD", "AAP_PASSWORD"])), ah_path_prefix=dict( required=False, default="galaxy", @@ -47,20 +54,22 @@ class AHModule(AnsibleModule): ), validate_certs=dict( type="bool", - aliases=["ah_verify_ssl"], + aliases=["ah_verify_ssl", "aap_validate_certs"], required=False, - fallback=(env_fallback, ["AH_VERIFY_SSL"]), + fallback=(env_fallback, ["AH_VERIFY_SSL", "AAP_VALIDATE_CERTS"]), ), ah_token=dict( type="raw", no_log=True, + aliases=["aap_token"], required=False, - fallback=(env_fallback, ["AH_API_TOKEN"]), + fallback=(env_fallback, ["AH_API_TOKEN", "AAP_TOKEN"]), ), request_timeout=dict( type="float", + aliases=["aap_request_timeout"], required=False, - fallback=(env_fallback, ["AH_REQUEST_TIMEOUT"]) + fallback=(env_fallback, ["AH_REQUEST_TIMEOUT", "AAP_REQUEST_TIMEOUT"]) ), ) ENCRYPTED_STRING = "$encrypted$"