It may not be as difficult as you think, and, you can *just* use it to insert a fake Fact, you don't have to start actually classifying your node classes with it.
I supplied our ENC to the list a while ago, it's just a bit of Python that reads YAML: https://groups.google.com/forum/#!searchin/puppet-users/luke$20bigum%7Csort:date/puppet-users/XWAcm152cyQ/P_rpi50XBAAJ On Tuesday, 25 October 2016 20:09:15 UTC+1, Ugo Bellavance wrote: > > Hi, > > I was actually wondering if it could be done without an ENC as we don't > have one for now. > > Thanks a lot for your input though. > > Ugo > > On Tuesday, October 18, 2016 at 3:50:37 PM UTC-4, Matt Zagrabelny wrote: >> >> On Tue, Oct 18, 2016 at 1:34 PM, Ugo Bellavance <[email protected]> wrote: >> > Hi, >> > >> > I've seen tutorials where they add the role as a fact in an client and >> then >> > can use the role for hiera data. Is there a better way to do so (ie >> without >> > having to configure anything on the client)? >> >> As a matter of fact there is a better way. >> >> If you use an ENC, then you can return the role as a top scope >> variable and your hiera configs can leverage those top scope >> variables. >> >> Here is an example where I've scrubbed any of our site data: >> >> # puppet-enc ldap.example.com >> --- >> classes: >> role::directory_server: null >> environment: production >> parameters: >> context: production >> role: role::directory_server >> >> The "classes" at the top and its "role" are for the classifying of the >> ENC, but the "context" and "role" in the "parameters" near the bottom >> are variables that get exposed - hiera is one of the things that can >> use those variables. >> >> This works super slick for us. >> >> For what it is worth, we also use a notion of context that allows our >> ENC to describe whether a node is a "testing" or "production" type >> system - we have hiera lookups based on that data, too. >> >> Let me know if you want the hiera configs. >> >> -m >> > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/cf74c37d-1b97-4326-9766-a10cf7e54f43%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
