salt.sdb.etcd_db#
etcd Database Module
- depends:
etcd3gw
- platform:
all
New in version 2015.5.0.
Changed in version 3009.0: Restored for the etcd v3 API after its removal in 3008.0. It uses
salt.utils.etcd_util, so the etcd v2 API and the
etcd.require_v2 option are no longer supported.
This module allows access to the etcd database using an sdb:// URI. It
needs the etcd3gw library (salt-pip install etcd3gw).
Like all sdb modules, the etcd module requires a configuration profile to be configured in either the minion or master configuration file. This profile requires very little. In the example:
myetcd:
driver: etcd
etcd.host: 127.0.0.1
etcd.port: 2379
The driver refers to the etcd module, etcd.host refers to the host that
is hosting the etcd database and etcd.port refers to the port on that host.
The profile takes the other etcd.* options of salt.utils.etcd_util
as well, such as etcd.username/etcd.password and the TLS options.
password: sdb://myetcd/mypassword
Values are stored msgpack-encoded unless the profile sets
etcd.encode_values: False. Set it to read values written by other tools,
such as etcdctl.
get returns None for a key that does not exist. Errors talking to etcd,
such as an unreachable server, bad credentials or a permission error, raise
instead of reading as a missing key.
- salt.sdb.etcd_db.delete(key, service=None, profile=None)#
Delete a key from the etcd service. Returns
Trueif the key was deleted andFalseif it did not exist.
- salt.sdb.etcd_db.get(key, service=None, profile=None)#
Get a value from the etcd service, or
Noneif the key does not exist
- salt.sdb.etcd_db.set_(key, value, service=None, profile=None)#
Set a key/value pair in the etcd service. Returns the value written.