Right way to implement "roles" in hiera/puppet

194 views
Skip to first unread message

Bret Wortman

unread,
Nov 27, 2012, 7:32:23 AM11/27/12
to puppet...@googlegroups.com
I'm looking to implement a hiera backend for our Puppet installation, as we routinely deploy systems that are of varying hardware, OS, and which may have multiple roles they fill.

I've figured out, I think, how to handle the OS question through facter, but implementing server roles isn't quite so clear. I want to maintain that information on the server, not on the clients, but everything hiera-related seems to use the facts for a given system. Installing a file containing the roles on the client seems like a kludge. Is there a more hiera-ish, puppet-ish way to accomplish this?

Thanks!

jcbollinger

unread,
Nov 28, 2012, 9:57:11 AM11/28/12
to puppet...@googlegroups.com


On Tuesday, November 27, 2012 6:32:23 AM UTC-6, Bret Wortman wrote:
I'm looking to implement a hiera backend for our Puppet installation, as we routinely deploy systems that are of varying hardware, OS, and which may have multiple roles they fill.

I've figured out, I think, how to handle the OS question through facter, but implementing server roles isn't quite so clear. I want to maintain that information on the server, not on the clients, but everything hiera-related seems to use the facts for a given system. Installing a file containing the roles on the client seems like a kludge. Is there a more hiera-ish, puppet-ish way to accomplish this?


Suppose you define one class for each role (each of which may declare any number of resources and other classes).  In Puppet 3, I think you can do this:

# An array of the names of the needed role classes
$role_classes = hiera('role_classes')

# Declare those classes
include ${role_classes}

If I recall correctly, though, you can accomplish the same thing, even in Puppet 2.[67], with

hiera_include('role_classes')


John

Reply all
Reply to author
Forward
0 new messages