New in version 1.9.
The below requirements are needed on the local master node that executes this lookup.
Parameter |
Choices/Defaults |
Configuration |
Comments |
---|---|---|---|
_raw
required |
|
|
List of key(s) to retrieve.
|
host
|
Default:
localhost
|
env:ANSIBLE_CONSUL_URL
|
The target to connect to, must be a resolvable address.
|
index
|
|
|
If the key has a value with the specified index then this is returned allowing access to historical values.
|
port
|
Default:
8500
|
|
The port of the target host to connect to.
|
recurse
|
Default:
no
|
|
If true, will retrieve all the values that have the given key as prefix.
|
token
|
|
|
The acl token to allow access to restricted values.
|
- debug:
msg: 'key contains {{item}}'
with_consul_kv:
- 'key/to/retrieve'
- name: Parameters can be provided after the key be more specific about what to retrieve
debug:
msg: 'key contains {{item}}'
with_consul_kv:
- 'key/to recurse=true token=E6C060A9-26FB-407A-B83E-12DDAFCB4D98'
- name: retrieving a KV from a remote cluster on non default port
debug:
msg: "{{ lookup('consul_kv', 'my/key', host='10.10.10.10', port='2000') }}"
Common return values are documented here, the following are the fields unique to this lookup:
Key |
Returned |
Description |
---|---|---|
_raw
|
Value(s) stored in consul.
|
Hint
If you notice any issues in this documentation you can edit this document to improve it.