Use consul data as a Pillar source
depends: |
|
---|
In order to use an consul server, a profile must be created in the master configuration file:
my_consul_config:
consul.host: 127.0.0.1
consul.port: 8500
After the profile is created, configure the external pillar system to use it. Optionally, a root may be specified.
ext_pillar:
- consul: my_consul_config
ext_pillar:
- consul: my_consul_config root=/salt
Using these configuration profiles, multiple consul sources may also be used:
ext_pillar:
- consul: my_consul_config
- consul: my_other_consul_config
The minion_id
may be used in the root
path to expose minion-specific
information stored in consul.
ext_pillar:
- consul: my_consul_config root=/salt/%(minion_id)s
Minion-specific values may override shared values when the minion-specific root appears after the shared root:
ext_pillar:
- consul: my_consul_config root=/salt-shared
- consul: my_other_consul_config root=/salt-private/%(minion_id)s
salt.pillar.consul_pillar.
consul_fetch
(client, path)¶Query consul for all keys/values within base path
salt.pillar.consul_pillar.
ext_pillar
(minion_id, pillar, conf)¶Check consul for all data
salt.pillar.consul_pillar.
fetch_tree
(client, path)¶Grab data from consul, trim base path and remove any keys which are folders. Take the remaining data and send it to be formatted in such a way as to be used as pillar data.
salt.pillar.consul_pillar.
get_conn
(opts, profile)¶Return a client object for accessing consul
salt.pillar.consul_pillar.
pillar_format
(ret, keys, value)¶Perform data formatting to be used as pillar data and merge it with the current pillar data