W3cubDocs

/Ansible 2.10

community.general.etcd3 – Get key values from etcd3 server

Note

This plugin is part of the community.general collection.

To install it use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.etcd3.

New in version 0.2.0: of community.general

Synopsis

Requirements

The below requirements are needed on the local controller node that executes this lookup.

  • etcd3 >= 0.10

Parameters

Parameter Choices/Defaults Configuration Comments
_terms
list / elements=string / required
The list of keys (or key prefixes) to look up on the etcd3 server.
ca_cert
string
env:ETCDCTL_CACERT
etcd3 CA authority.
cert_cert
string
env:ETCDCTL_CERT
etcd3 client certificate.
cert_key
string
env:ETCDCTL_KEY
etcd3 client private key.
endpoints
string
Default:
"127.0.0.1:2379"
env:ETCDCTL_ENDPOINTS
Counterpart of ETCDCTL_ENDPOINTS environment variable. Specify the etcd3 connection with and URL form eg. https://hostname:2379 or <host>:<port> form.
The host part is overwritten by host option, if defined.
The port part is overwritten by port option, if defined.
host
string
etcd3 listening client host.
Takes precedence over endpoints.
password
string
env:ETCDCTL_PASSWORD
Authenticated user password.
port
integer
etcd3 listening client port.
Takes precedence over endpoints.
prefix
boolean
    Choices:
  • no
  • yes
Look for key or prefix key.
timeout
integer
Default:
60
env:ETCDCTL_DIAL_TIMEOUT
Client timeout.
user
string
env:ETCDCTL_USER
Authenticated user name.

Notes

Note

  • host and port options take precedence over (endpoints) option.
  • The recommended way to connect to etcd3 server is using ETCDCTL_ENDPOINT environment variable and keep endpoints, host, and port unused.

See Also

See also

community.general.etcd3

The official documentation on the community.general.etcd3 module.

etcd – get info from an etcd server

The etcd v2 lookup.

Examples

- 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') }}"

Return Values

Common return values are documented here, the following are the fields unique to this lookup:

Key Returned Description
_raw
list / elements=dictionary
success
List of keys and associated values.

key
string
success
The element's key.

value
string
success
The element's value.



Authors

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/general/etcd3_lookup.html