Note
This lookup plugin is part of the community.general collection (version 10.7.3).
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. You need further requirements to be able to use this lookup plugin, see Requirements for details.
To use it in a playbook, specify: community.general.etcd3.
New in community.general 0.2.0
ETCDCTL_* environment variables.The below requirements are needed on the local controller node that executes this lookup.
Parameter | Comments |
|---|---|
Terms list / elements=string / required | The list of keys (or key prefixes) to look up on the etcd3 server. |
This describes keyword parameters of the lookup. These are the values key1=value1, key2=value2 and so on in the following examples: lookup('community.general.etcd3', key1=value1, key2=value2, ...) and query('community.general.etcd3', key1=value1, key2=value2, ...)
Parameter | Comments |
|---|---|
ca_cert string | |
cert_cert string | |
cert_key string | |
endpoints string | Counterpart of The The Default: Configuration:
|
host string | Etcd3 listening client host. Takes precedence over |
password string | |
port integer | Etcd3 listening client port. Takes precedence over |
prefix boolean | Look for key or prefix key. Choices:
|
timeout integer | |
user string |
Note
lookup('community.general.etcd3', term1, term2, key1=value1, key2=value2) and query('community.general.etcd3', term1, term2, key1=value1, key2=value2)
host and port options take precedence over (endpoints) option.ETCDCTL_ENDPOINT environment variable and keep endpoints, host, and port unused.See also
Set or delete key value pairs from an etcd3 cluster.
get info from an etcd server.
- name: "a value from a locally running etcd"
ansible.builtin.debug:
msg: "{{ lookup('community.general.etcd3', 'foo/bar') }}"
- name: "values from multiple folders on a locally running etcd"
ansible.builtin.debug:
msg: "{{ lookup('community.general.etcd3', 'foo', 'bar', 'baz') }}"
- name: "look for a key prefix"
ansible.builtin.debug:
msg: "{{ lookup('community.general.etcd3', '/foo/bar', prefix=True) }}"
- name: "connect to etcd3 with a client certificate"
ansible.builtin.debug:
msg: "{{ lookup('community.general.etcd3', 'foo/bar', cert_cert='/etc/ssl/etcd/client.pem', cert_key='/etc/ssl/etcd/client.key') }}"
Key | Description |
|---|---|
Return value list / elements=dictionary | List of keys and associated values. Returned: success |
|
key string |
The element’s key. Returned: success |
|
value string |
The element’s value. Returned: success |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/etcd3_lookup.html