Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jsok/hiera-consul
A Hiera backend to retrieve configuration from Hashicorp's Consul KV store
https://github.com/jsok/hiera-consul
Last synced: 3 months ago
JSON representation
A Hiera backend to retrieve configuration from Hashicorp's Consul KV store
- Host: GitHub
- URL: https://github.com/jsok/hiera-consul
- Owner: jsok
- License: apache-2.0
- Created: 2015-06-19T07:54:32.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-22T01:48:38.000Z (over 9 years ago)
- Last Synced: 2024-04-24T13:10:53.574Z (9 months ago)
- Language: Ruby
- Size: 125 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Gem Version Badge](https://img.shields.io/gem/v/hiera-consul.svg)](https://rubygems.org/gems/hiera-consul)
# hiera-consul
A Hiera backend to retrieve configuration from Hashicorp's Consul KV store## Configuration
You should modify `hiera.yaml` as follows:
:backends:
- consul:consul:
:addr: # parsed from CONSUL_HTTP_ADDR if not specified
:port: # parsed from CONSUL_HTTP_ADDR if not specified
:paths:
- /v1/kv/hiera
- /v1/kv/%{environment}## Lookups
Only string and hash lookups are support, i.e. `hiera()` and `hiera_hash()`.
A string lookup will return the contents of the value at the specified key.
### Hash lookups
A hash lookup will use the `recurse` parameter of the
[KV HTTP API](https://www.consul.io/docs/agent/http/kv.html) and performs a
deep merge to produce an answer.Example (values have been base64 decoded for clarity):
> curl http://127.0.0.1:8500/v1/kv/hiera/foo?recurse
[
{
"CreateIndex": 1,
"Flags": 0,
"Key": "foo/",
"LockIndex": 0,
"ModifyIndex": 305244,
"Value": null
},
{
"CreateIndex": 2,
"Flags": 0,
"Key": "foo/bar",
"LockIndex": 0,
"ModifyIndex": 305244,
"Value": "42"
},
{
"CreateIndex": 3,
"Flags": 0,
"Key": "foo/baz",
"LockIndex": 0,
"ModifyIndex": 305244,
"Value": null
},
{
"CreateIndex": 4,
"Flags": 0,
"Key": "foo/baz/qux",
"LockIndex": 0,
"ModifyIndex": 305244,
"Value": "hello"
}
]Will return an answer:
> hiera -h foo
{
"foo" => {
"bar" => "42",
"baz" => {
"qux" => "hello"
}
}
}## TODO
This is very much alpha, some improvements:
- [ ] Add configuration options for SSL/TLS
- [ ] Setup CI