mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
lookup: consul_kv: Add datacenter parameter (#56647)
This commit is contained in:
parent
d8c1f67862
commit
3e8ca0285f
1 changed files with 9 additions and 2 deletions
|
@ -31,6 +31,11 @@ DOCUMENTATION = """
|
||||||
index:
|
index:
|
||||||
description:
|
description:
|
||||||
- If the key has a value with the specified index then this is returned allowing access to historical values.
|
- If the key has a value with the specified index then this is returned allowing access to historical values.
|
||||||
|
datacenter:
|
||||||
|
default: None
|
||||||
|
description:
|
||||||
|
- Retrieve the key from a consul datatacenter other than the default for the consul host.
|
||||||
|
version_added: "2.9"
|
||||||
token:
|
token:
|
||||||
description: The acl token to allow access to restricted values.
|
description: The acl token to allow access to restricted values.
|
||||||
host:
|
host:
|
||||||
|
@ -144,7 +149,8 @@ class LookupModule(LookupBase):
|
||||||
results = consul_api.kv.get(params['key'],
|
results = consul_api.kv.get(params['key'],
|
||||||
token=params['token'],
|
token=params['token'],
|
||||||
index=params['index'],
|
index=params['index'],
|
||||||
recurse=params['recurse'])
|
recurse=params['recurse'],
|
||||||
|
dc=params['datacenter'])
|
||||||
if results[1]:
|
if results[1]:
|
||||||
# responds with a single or list of result maps
|
# responds with a single or list of result maps
|
||||||
if isinstance(results[1], list):
|
if isinstance(results[1], list):
|
||||||
|
@ -165,7 +171,8 @@ class LookupModule(LookupBase):
|
||||||
'key': params[0],
|
'key': params[0],
|
||||||
'token': None,
|
'token': None,
|
||||||
'recurse': False,
|
'recurse': False,
|
||||||
'index': None
|
'index': None,
|
||||||
|
'datacenter': None
|
||||||
}
|
}
|
||||||
|
|
||||||
# parameters specified?
|
# parameters specified?
|
||||||
|
|
Loading…
Reference in a new issue