salt.cache.consul module

Minion data cache plugin for Consul key/value data store.

New in version 2016.11.2.

depends:python-consul >= 0.2.0

It is up to the system administrator to set up and configure the Consul infrastructure. All is needed for this plugin is a working Consul agent with a read-write access to the key-value store.

The related documentation can be found in the Consul documentation.

To enable this cache plugin, the master will need the python client for Consul installed. This can be easily installed with pip:

Optionally, depending on the Consul agent configuration, the following values could be set in the master config. These are the defaults:

consul.host: 127.0.0.1
consul.port: 8500
consul.token: None
consul.scheme: http
consul.consistency: default
consul.dc: dc1
consul.verify: True

Related docs could be found in the python-consul documentation.

To use the consul as a minion data cache backend, set the master cache config value to consul:

cache: consul
salt.cache.consul.contains(bank, key)

Checks if the specified bank contains the specified key.

salt.cache.consul.fetch(bank, key)

Fetch a key value.

salt.cache.consul.flush(bank, key=None)

Remove the key from the cache bank with all the key content.

salt.cache.consul.list(bank)

Return an iterable object containing all entries stored in the specified bank.

salt.cache.consul.store(bank, key, data)

Store a key value.