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 13.3.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. |
|
The name of the datacenter to query. If unspecified, the query defaults to the datacenter of the Consul agent on |
|
Host of the Consul agent. Default: |
|
The key to retrieve. When |
|
The port on which the consul agent is running. Default: |
|
The protocol scheme on which the Consul agent is running. Defaults to Default: |
|
The token to use for authorization. |
|
Whether to verify the TLS certificate of the Consul agent. 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 |