Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type options of lookup plugins #8626

Merged
merged 1 commit into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/8626-lookup-types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- "chef_databag, consul_kv, cyberarkpassword, dsv, etcd, filetree, hiera, onepassword, onepassword_doc, onepassword_raw, passwordstore, redis, shelvefile, tss lookup plugins - make sure that all options are typed (https://github.com/ansible-collections/community.general/pull/8626)."
2 changes: 2 additions & 0 deletions plugins/lookup/chef_databag.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
name:
description:
- Name of the databag
type: string
required: true
item:
description:
- Item to fetch
type: string
required: true
'''

Expand Down
14 changes: 11 additions & 3 deletions plugins/lookup/consul_kv.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@
index:
description:
- If the key has a value with the specified index then this is returned allowing access to historical values.
type: int
datacenter:
description:
- Retrieve the key from a consul datacenter other than the default for the consul host.
type: str
felixfontein marked this conversation as resolved.
Show resolved Hide resolved
token:
description: The acl token to allow access to restricted values.
type: str
host:
default: localhost
type: str
description:
- The target to connect to, must be a resolvable address.
- Will be determined from E(ANSIBLE_CONSUL_URL) if that is set.
Expand All @@ -46,22 +50,26 @@
description:
- The port of the target host to connect to.
- If you use E(ANSIBLE_CONSUL_URL) this value will be used from there.
type: int
default: 8500
scheme:
default: http
type: str
description:
- Whether to use http or https.
- If you use E(ANSIBLE_CONSUL_URL) this value will be used from there.
validate_certs:
default: true
description: Whether to verify the ssl connection or not.
description: Whether to verify the TLS connection or not.
type: bool
env:
- name: ANSIBLE_CONSUL_VALIDATE_CERTS
ini:
- section: lookup_consul
key: validate_certs
client_cert:
description: The client cert to verify the ssl connection.
description: The client cert to verify the TLS connection.
type: str
env:
- name: ANSIBLE_CONSUL_CLIENT_CERT
ini:
Expand Down Expand Up @@ -94,7 +102,7 @@

- name: retrieving a KV from a remote cluster on non default port
ansible.builtin.debug:
msg: "{{ lookup('community.general.consul_kv', 'my/key', host='10.10.10.10', port='2000') }}"
msg: "{{ lookup('community.general.consul_kv', 'my/key', host='10.10.10.10', port=2000) }}"
"""

RETURN = """
Expand Down
4 changes: 4 additions & 0 deletions plugins/lookup/cyberarkpassword.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,23 @@
options :
_command:
description: Cyberark CLI utility.
type: string
env:
- name: AIM_CLIPASSWORDSDK_CMD
default: '/opt/CARKaim/sdk/clipasswordsdk'
appid:
description: Defines the unique ID of the application that is issuing the password request.
type: string
required: true
query:
description: Describes the filter criteria for the password retrieval.
type: string
required: true
output:
description:
- Specifies the desired output fields separated by commas.
- "They could be: Password, PassProps.<property>, PasswordChangeInProcess"
type: string
default: 'password'
_extra:
description: for extra_params values please check parameters for clipasswordsdk in CyberArk's "Credential Provider and ASCP Implementation Guide"
Expand Down
5 changes: 5 additions & 0 deletions plugins/lookup/dsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
required: true
tenant:
description: The first format parameter in the default O(url_template).
type: string
env:
- name: DSV_TENANT
ini:
Expand All @@ -32,6 +33,7 @@
default: com
description: The top-level domain of the tenant; the second format
parameter in the default O(url_template).
type: string
env:
- name: DSV_TLD
ini:
Expand All @@ -40,6 +42,7 @@
required: false
client_id:
description: The client_id with which to request the Access Grant.
type: string
env:
- name: DSV_CLIENT_ID
ini:
Expand All @@ -48,6 +51,7 @@
required: true
client_secret:
description: The client secret associated with the specific O(client_id).
type: string
env:
- name: DSV_CLIENT_SECRET
ini:
Expand All @@ -58,6 +62,7 @@
default: https://{}.secretsvaultcloud.{}/v1
description: The path to prepend to the base URL to form a valid REST
API request.
type: string
env:
- name: DSV_URL_TEMPLATE
ini:
Expand Down
2 changes: 2 additions & 0 deletions plugins/lookup/etcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
url:
description:
- Environment variable with the URL for the etcd server
type: string
default: 'http://127.0.0.1:4001'
env:
- name: ANSIBLE_ETCD_URL
version:
description:
- Environment variable with the etcd protocol version
type: string
default: 'v1'
env:
- name: ANSIBLE_ETCD_VERSION
Expand Down
4 changes: 3 additions & 1 deletion plugins/lookup/filetree.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
This enables merging different trees in order of importance, or add role_vars to specific paths to influence different instances of the same role.
options:
_terms:
description: path(s) of files to read
description: Path(s) of files to read.
required: true
type: list
elements: string
'''

EXAMPLES = r"""
Expand Down
2 changes: 2 additions & 0 deletions plugins/lookup/hiera.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
executable:
description:
- Binary file to execute Hiera.
type: string
default: '/usr/bin/hiera'
env:
- name: ANSIBLE_HIERA_BIN
config_file:
description:
- File that describes the hierarchy of Hiera.
type: string
default: '/etc/hiera.yaml'
env:
- name: ANSIBLE_HIERA_CFG
Expand Down
2 changes: 2 additions & 0 deletions plugins/lookup/onepassword.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
_terms:
description: Identifier(s) (case-insensitive UUID or name) of item(s) to retrieve.
required: true
type: list
elements: string
account_id:
version_added: 7.5.0
domain:
Expand Down
2 changes: 2 additions & 0 deletions plugins/lookup/onepassword_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
_terms:
description: Identifier(s) (case-insensitive UUID or name) of item(s) to retrieve.
required: true
type: list
elements: string

extends_documentation_fragment:
- community.general.onepassword
Expand Down
2 changes: 2 additions & 0 deletions plugins/lookup/onepassword_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
_terms:
description: Identifier(s) (case-insensitive UUID or name) of item(s) to retrieve.
required: true
type: list
elements: string
account_id:
version_added: 7.5.0
domain:
Expand Down
3 changes: 2 additions & 1 deletion plugins/lookup/passwordstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
default: false
umask:
description:
- Sets the umask for the created .gpg files. The first octed must be greater than 3 (user readable).
- Sets the umask for the created V(.gpg) files. The first octed must be greater than 3 (user readable).
- Note pass' default value is V('077').
type: string
env:
- name: PASSWORD_STORE_UMASK
version_added: 1.3.0
Expand Down
3 changes: 3 additions & 0 deletions plugins/lookup/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@
options:
_terms:
description: list of keys to query
type: list
elements: string
host:
description: location of Redis host
type: string
default: '127.0.0.1'
env:
- name: ANSIBLE_REDIS_HOST
Expand Down
4 changes: 4 additions & 0 deletions plugins/lookup/shelvefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
options:
_terms:
description: Sets of key value pairs of parameters.
type: list
elements: str
key:
description: Key to query.
type: str
required: true
file:
description: Path to shelve file.
type: path
required: true
'''

Expand Down
10 changes: 9 additions & 1 deletion plugins/lookup/tss.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
_terms:
description: The integer ID of the secret.
required: true
type: int
type: list
elements: int
secret_path:
description: Indicate a full path of secret including folder and secret name when the secret ID is set to 0.
required: false
Expand All @@ -52,6 +53,7 @@
version_added: 7.0.0
base_url:
description: The base URL of the server, for example V(https://localhost/SecretServer).
type: string
env:
- name: TSS_BASE_URL
ini:
Expand All @@ -60,6 +62,7 @@
required: true
username:
description: The username with which to request the OAuth2 Access Grant.
type: string
env:
- name: TSS_USERNAME
ini:
Expand All @@ -69,6 +72,7 @@
description:
- The password associated with the supplied username.
- Required when O(token) is not provided.
type: string
env:
- name: TSS_PASSWORD
ini:
Expand All @@ -80,6 +84,7 @@
- The domain with which to request the OAuth2 Access Grant.
- Optional when O(token) is not provided.
- Requires C(python-tss-sdk) version 1.0.0 or greater.
type: string
env:
- name: TSS_DOMAIN
ini:
Expand All @@ -92,6 +97,7 @@
- Existing token for Thycotic authorizer.
- If provided, O(username) and O(password) are not needed.
- Requires C(python-tss-sdk) version 1.0.0 or greater.
type: string
env:
- name: TSS_TOKEN
ini:
Expand All @@ -102,13 +108,15 @@
default: /api/v1
description: The path to append to the base URL to form a valid REST
API request.
type: string
env:
- name: TSS_API_PATH_URI
required: false
token_path_uri:
default: /oauth2/token
description: The path to append to the base URL to form a valid OAuth2
Access Grant request.
type: string
env:
- name: TSS_TOKEN_PATH_URI
required: false
Expand Down