claranet / puppet-consul_template

A Puppet module to manage the config and jobs of Consul Template from Hashicorp
Apache License 2.0
30 stars 89 forks source link

Functionality via Hiera #54

Closed ccampanale closed 8 years ago

ccampanale commented 8 years ago

Great work on this module (sorry I've never mentioned this before now...)!

I am currently using this module directly from hiera which is great for me as I don't need to write and maintain a wrapper/profile for it. One downside is that I cannot use the defined types directly through hiera (unless I am missing something) so I am using some trickery to get a template defined in my startup script.

consul_template::extra_options: |
  '-template /path/to/my/template.ctmpl:/path/to/my/output.out'

What I would like to request is that this module's defined types are made accessible through the init.pp class. I've implemented this myself (and seen it done elsewhere) simply by including a parameter that is to be a hash of types which is later verified and passed to create_resources('type', $hash). This would greatly simplify using consul_template::watch: for anyone using this module directly from hiera!

Please let me know if you have any questions or again, if I am missing something.

Thanks again!

gdhbashton commented 8 years ago

Hm that sounds interesting - can you show me an example of another module doing this so I have some basis to compare?

ccampanale commented 8 years ago

Sure thing!

Check out @solarkennedy's Consul module. You can see how he includes hashes in his init.pp that are later checked and if defined uses create_resources() for those types.

This seems to be the direction that a lot of modules have taken as it help to support declaration directly from hiera as well as utilization via puppetcode (in the event the organization decides a role/profile type wrapper is necessary). For our purposes, a wrapper isn't entirely necessary but including this functionality would be fantastic and solidify this!

Let me know what you think.

gdhbashton commented 8 years ago

Heh that's funny - I based this module wholly on solarkennedy's consul module before he refactored it to use newer patterns - I'll give the init.pp setup a look and see if it can be integrated without too much pain.

gdhbashton commented 8 years ago

Give master a go and let me know? :)

ccampanale commented 8 years ago

Sweeeet! When I get a chance I'll VPN in and take the change for a ride and report back! Looks like it should do the trick though! :smile:

gdhbashton commented 8 years ago

Fingers crossed - I'll close this issue - feel free to reopen it if there are problems.