-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to Hiera 5 format? #23
Comments
+1 |
Hey guys, |
@fatmcgav Have you had a chance to try updating the module for Hiera 5? I might give it a go if you haven't 😄 Docs are here: https://docs.puppet.com/puppet/5.0/hiera_custom_lookup_key.html |
@petems No, haven't had time to get to this one yet... Feel free to give it a stab :) |
Hi All, has there been any movement on this? We're currently at a crossroad and we're pondering whether waiting for this or find some other solution. Thanks! |
@elisiano I'm planning to pair up with some of the hiera whiz-kid engineers to implement this when he's back from PTO, should have something whipped up before end of August. What kinda time frame you looking for? |
@petems thanks for the update. We will wait until the end of August then! |
@elisiano can you use a module specific version three hiera file for this module and retain your version five file at the global scope for everything else? |
How would I go about that? |
Ok, been a bit busy recently, but a colleague (the awesome @LMacchi) has made a hiera 5 backend for MSSQL, so it should be fairly easy to re-adapt for consul! 😄 https://github.com/LMacchi/hiera_mssql Reminder 👍 |
That is very nice work. Makes me want to steal it and make one for PostgreSQL. Is the change to the Consul backed module just the following?
|
Any movement on this? I tried using the mongodb example for translating to a hiera3_backend config but no joy. |
Small update. I got the hiera3_backend approach working after noticing that the path value should existing in the options hash. I went this route because i wanted to use 4.10 with the new embedded eyaml feature at the global level which meant a version 5 hiera config format
|
This looks like a good workaround, mind if I update the docs with this? |
Sure go for it. |
This still needs some testing, im getting weird results, puppet lookup works on the master. the catalog compiles on the master, but when i try and run puppet agent -t on the node i get a message saying lookup cannot find the value. And there are lookup errors in the puppet logs.... |
I can help a bit with that @devoncustard.
Ruby and jruby are quite different creatures, so what works for one might not work for the other. Finally, you might run into needing different libraries for ruby and jruby, that's what happens with mssql. You can create code blocks for each library and then call the relevant one like this: https://github.com/LMacchi/hiera_mssql/blob/master/lib/puppet/functions/mssql_lookup_key.rb#L4 L. |
@LMacchi ok ill have a look at that but given that it works with a standard Hiera 3 config like the one below im confused why the hiera 5 config doesnt work. I didnt think i needed to install any gems for hiera-consul ...... Like i said if i run puppet lookup in the node context on the master all is fine. Your comments about ruby and jruby make a lot of sense. My original issue was trying to get hiera 5/eyaml and consul all working together in the global tier. Looks like ive managed to do that with the version 3 file. Probably the full reinstall of puppet cleared out some funky config and its all behaving now. Ill probably try and solve this again after i take a timeout, bashed my head against a brick wall for hours over this today and its working with the version 3 config. :backends:
:hierarchy:
:yaml: :consul: :eyaml: |
I've been working on this a bit. I'd like to split up the lookup's up to support lookup_key (i.e == string), and data_hash (i.e. return consul json as hash). I also think the services and nodes should be separated into a separate lookup function to make it easier to prevent collisions. This would require a major version bump since the API would change. hierarchy:
- name: "Consul Node"
lookup_key: consul_lookup_node
options:
host: 192.168.32.134
port: 8080
key_prefix : ::consul_node:: lookup('::consul_node::localhost') would query /v1/catalog/node/localhost, and return the hash for that node. Similarly for services, while still being compatible with the consul_info helper. Thoughts? |
Hey @iwagnerclgx could you show some examples of that? I like it but it might break current implementations as well |
There's a vault Hiera 5 function for Vault by @davealden, I assume the code would be fairly similar: https://github.com/davealden/hiera-vault |
I have consul_lookup_key and consul_datahash implemented in https://github.com/iwagnerclgx/hiera-consul/tree/develop/lib/puppet/functions. I haven't done a lot of testing, so ymmv. I made these two only compatible with kv. For the consul_lookup_service example, the function would only trigger if key_prefix was in the lookup string. So for instance, doing a |
Is anybody still looking at this? I'd like to get the docs updated to include a hiera 5 example. I can have a stab if its not already done? |
I've been using https://github.com/davealden/hiera-vault for Vault Hiera 5 integrations, and the implmentation would be fairly similar to Consul from looking if that code if it helps 😄 |
Sorry, work has been crazy these last months, will look into it ASAP, if someone wants to have a go at it as well please feel free to. |
I've started working on this today :) |
much as i love the idea of a dedicated consul backend for hiera 5, the lack of movement (and my own inability to write ruby) has led me to an alternative solution. Using crayfishx/http_hiera works like charm. Kinda ironic as its gone full circle. took me about an hour to get this all working (and i can be quite dumb n slow at times) I used this sample hiera.yaml to get it working. The KEY interpolation is really nice, and i havent looked too hard at the DIG functionality but it might make bulk config a lot easier..... This will definitely get you working with consul and hiera 5. version: 5 hierarchy:
|
Sorry to advertise here but as there have been few updates I made a consul lookup compatible with hiera 5 hiera_consul. The workings are a bit different I wrote about it in my readme. I did use some code from hiera-http though. |
@lynxman Have you got any plans to update this Hiera backend to support Hiera 5.x?
If not, I might be able to take a stab...
The text was updated successfully, but these errors were encountered: