salt.cache.etcd_cache#
Minion data cache plugin for Etcd key/value data store.
New in version 2018.3.0.
Changed in version 3005.
It is up to the system administrator to set up and configure the Etcd infrastructure. All is needed for this plugin is a working Etcd agent with a read-write access to the key-value store.
The related documentation can be found in the Etcd documentation.
To enable this cache plugin, the master will need the python client for Etcd installed. This can be easily installed with pip:
pip install python-etcd
Note
While etcd API v3 has been implemented in other places within salt, etcd_cache does not support it at this time due to fundamental differences in how the versions are designed and v3 not being compatible with the cache API.
Optionally, depending on the Etcd agent configuration, the following values could be set in the master config. These are the defaults:
etcd.host: 127.0.0.1
etcd.port: 2379
etcd.protocol: http
etcd.allow_reconnect: True
etcd.allow_redirect: False
etcd.srv_domain: None
etcd.read_timeout: 60
etcd.username: None
etcd.password: None
etcd.cert: None
etcd.ca_cert: None
Related docs could be found in the python-etcd documentation.
To use the etcd as a minion data cache backend, set the master cache config
value to etcd:
cache: etcd
ls/list returns the immediate entries stored in a bank (the direct
children of the bank path), matching the behavior of the other cache backends
(e.g. localfs). This is what the master relies on to enumerate cached
minions via cache.list("minions").
- salt.cache.etcd_cache.contains(bank, key)#
Checks if the specified bank contains the specified key.
- salt.cache.etcd_cache.fetch(bank, key)#
Fetch a key value.
- salt.cache.etcd_cache.flush(bank, key=None)#
Remove the key from the cache bank with all the key content.
- salt.cache.etcd_cache.ls(bank)#
Return an iterable object containing all entries stored in the specified bank.
Only the immediate children of the bank are returned -- the bank's own keys and any sub-banks -- matching the behavior of the other cache backends such as
localfs. In particular this is what lets the master enumerate cached minions viacache.list("minions"), where each minion is stored under its ownminions/<minion_id>sub-bank.
- salt.cache.etcd_cache.store(bank, key, data)#
Store a key value.
- salt.cache.etcd_cache.updated(bank, key)#
Return Unix Epoch based timestamp of when the bank/key was updated.