Skip to content

Commit

Permalink
update authentication arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-m-sullivan committed Nov 10, 2024
1 parent d9ddfd9 commit bdf30b0
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 22 deletions.
4 changes: 4 additions & 0 deletions changelogs/fragments/argument_vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
minor_changes:
- added additional options for authentication to match controller credential type updates.
...
19 changes: 12 additions & 7 deletions plugins/doc_fragments/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 15 additions & 7 deletions plugins/module_utils/ah_api_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,34 @@ 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",
fallback=(env_fallback, ["GALAXY_API_PATH_PREFIX"]),
),
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 = {
Expand Down
25 changes: 17 additions & 8 deletions plugins/module_utils/ah_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,41 @@ 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",
fallback=(env_fallback, ["GALAXY_API_PATH_PREFIX"]),
),
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$"
Expand Down

0 comments on commit bdf30b0

Please sign in to comment.