ansible.builtin.etcd3 (v2.9.27) — module

Set or delete key value pairs from an etcd3 cluster

| "added in version" 2.5 of ansible.builtin"

Authors: Jean-Philippe Evrard (@evrardjp), Victor Fauth (@vfauth)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Sets or deletes values in etcd3 cluster using its v3 api.

Needs python etcd3 lib to work


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Store a value "bar" under the key "foo" for a cluster located "http://localhost:2379"
- etcd3:
    key: "foo"
    value: "baz3"
    host: "localhost"
    port: 2379
    state: "present"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Authenticate using user/password combination with a timeout of 10 seconds
- etcd3:
    key: "foo"
    value: "baz3"
    state: "present"
    user: "someone"
    password: "password123"
    timeout: 10
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Authenticate using TLS certificates
- etcd3:
    key: "foo"
    value: "baz3"
    state: "present"
    ca_cert: "/etc/ssl/certs/CA_CERT.pem"
    client_cert: "/etc/ssl/certs/cert.crt"
    client_key: "/etc/ssl/private/key.pem"

Inputs

    
key:
    description:
    - the key where the information is stored in the cluster
    required: true

host:
    default: localhost
    description:
    - the IP address of the cluster

port:
    default: 2379
    description:
    - the port number used to connect to the cluster

user:
    description:
    - The etcd user to authenticate with.
    version_added: '2.8'
    version_added_collection: ansible.builtin

state:
    description:
    - the state of the value for the key.
    - can be present or absent
    required: true

value:
    description:
    - the information stored
    required: true

ca_cert:
    description:
    - The Certificate Authority to use to verify the etcd host.
    - Required if I(client_cert) and I(client_key) are defined.
    version_added: '2.8'
    version_added_collection: ansible.builtin

timeout:
    description:
    - The socket level timeout in seconds.
    version_added: '2.8'
    version_added_collection: ansible.builtin

password:
    description:
    - The password to use for authentication.
    - Required if I(user) is defined.
    version_added: '2.8'
    version_added_collection: ansible.builtin

client_key:
    description:
    - PEM formatted file that contains your private key to be used for SSL client authentication.
    - Required if I(client_cert) is defined.
    version_added: '2.8'
    version_added_collection: ansible.builtin

client_cert:
    description:
    - PEM formatted certificate chain file to be used for SSL client authentication.
    - Required if I(client_key) is defined.
    version_added: '2.8'
    version_added_collection: ansible.builtin

Outputs

key:
  description: The key that was queried
  returned: always
  type: str
old_value:
  description: The previous value in the cluster
  returned: always
  type: str