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

consul_kv: add argument for the datacenter option on consul api #9026

Merged
merged 3 commits into from
Oct 19, 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/9026-consul_kv-datacenter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- consul_kv - add argument for the datacenter option on Consul API (https://github.com/ansible-collections/community.general/pull/9026).
10 changes: 9 additions & 1 deletion plugins/modules/consul_kv.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@
- Whether to verify the tls certificate of the consul agent.
type: bool
default: true
datacenter:
description:
- The name of the datacenter to query. If unspecified, the query will default
to the datacenter of the Consul agent on O(host).
type: str
raspbeguy marked this conversation as resolved.
Show resolved Hide resolved
version_added: 10.0.0
'''


Expand Down Expand Up @@ -291,7 +297,8 @@ def get_consul_api(module):
port=module.params.get('port'),
scheme=module.params.get('scheme'),
verify=module.params.get('validate_certs'),
token=module.params.get('token'))
token=module.params.get('token'),
dc=module.params.get('datacenter'))
felixfontein marked this conversation as resolved.
Show resolved Hide resolved


def test_dependencies(module):
Expand All @@ -305,6 +312,7 @@ def main():
module = AnsibleModule(
argument_spec=dict(
cas=dict(type='str'),
datacenter=dict(type='str', default=None),
flags=dict(type='str'),
key=dict(type='str', required=True, no_log=False),
host=dict(type='str', default='localhost'),
Expand Down