On Tue, Oct 18, 2016 at 1:34 PM, Ugo Bellavance <u...@lubik.ca> 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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAOLfK3VHj6PVSUp0qYbvdR-yF8yhuchbEA%3D57FbUpK0E%3D3AKjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to