community.general.consul_kv_info module – Retrieve entries from the key/value store of a Consul cluster
Note
This module is part of the community.general collection (version 14.0.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.consul_kv_info.
New in community.general 13.3.0
Synopsis
Retrieve one or more key/value entries from a Consul cluster.
See https://developer.hashicorp.com/consul/api-docs/kv for more details.
Parameters
Parameter |
Comments |
|---|---|
The CA bundle to use for https connections. If unset, the value of the |
|
The name of the datacenter to query. If unspecified, the query defaults to the datacenter of the Consul agent on |
|
The key to retrieve. When |
|
The port on which the consul agent is running. If unset, the port component of |
|
The token to use for authorization. If unset, the value of the |
|
The address of the Consul agent, in the
If unset, the value of the |
|
Whether to verify the TLS certificate of the Consul agent. If unset, the value of the Choices:
|
Attributes
Attribute |
Support |
Description |
|---|---|---|
Action group: community.general.consul |
Use |
|
Support: full This action does not modify state. |
Can run in |
|
Support: N/A This action does not modify state. |
Returns details on what has changed (or possibly needs changing in |
Examples
- name: Retrieve a single key
community.general.consul_kv_info:
key: somekey
register: result
- name: Display the value
ansible.builtin.debug:
msg: "{{ result.data }}"
- name: Retrieve all keys under a prefix
community.general.consul_kv_info:
key: app/config/
recurse: true
register: result
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The list of KV entries matching the query. Each element is a dictionary with the keys The list is empty if the key does not exist. Returned: always |
|
The Consul index value from the Returned: always |