salt.modules.etcd_mod

Execution module to work with etcd

depends:
  • python-etcd

In order to use an etcd server, a profile should be created in the master configuration file:

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
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