Execution module to work with etcd
depends: |
|
---|
To work with an etcd server you must configure an etcd profile. The etcd config can be set in either the Salt Minion configuration file or in pillar:
my_etd_config:
etcd.host: 127.0.0.1
etcd.port: 4001
It is technically possible to configure etcd without using a profile, but this is not considered to be a best practice, especially when multiple etcd servers or clusters are available.
etcd.host: 127.0.0.1
etcd.port: 4001
Note
The etcd configuration can also be set in the Salt Master config file,
but in order to use any etcd configurations defined in the Salt Master
config, the pillar_opts
must be set to True
.
Be aware that setting pillar_opts
to True
has security implications
as this makes all master configuration settings available in all minion's
pillars.
salt.modules.etcd_mod.
get
(key, recurse=False, profile=None)¶New in version 2014.7.0.
Get a value from etcd, by direct path
CLI Examples:
salt myminion etcd.get /path/to/key
salt myminion etcd.get /path/to/key profile=my_etcd_config
salt myminion etcd.get /path/to/key recurse=True profile=my_etcd_config
salt.modules.etcd_mod.
ls
(path='/', profile=None)¶New in version 2014.7.0.
Return all keys and dirs inside a specific path
CLI Example:
salt myminion etcd.ls /path/to/dir/
salt myminion etcd.ls /path/to/dir/ profile=my_etcd_config
salt.modules.etcd_mod.
rm
(key, recurse=False, profile=None)¶New in version 2014.7.0.
Delete a key from etcd
CLI Example:
salt myminion etcd.rm /path/to/key
salt myminion etcd.rm /path/to/key profile=my_etcd_config
salt myminion etcd.rm /path/to/dir recurse=True profile=my_etcd_config
salt.modules.etcd_mod.
set
(key, value, profile=None)¶New in version 2014.7.0.
Set a value in etcd, by direct path
CLI Example:
salt myminion etcd.set /path/to/key value
salt myminion etcd.set /path/to/key value profile=my_etcd_config
salt.modules.etcd_mod.
tree
(path='/', profile=None)¶New in version 2014.7.0.
Recurse through etcd and return all values
CLI Example:
salt myminion etcd.tree
salt myminion etcd.tree profile=my_etcd_config
salt myminion etcd.tree /path/to/keys profile=my_etcd_config