Hi All,

I'm trying to add a new fact to puppet, which is the role the host has - 
I'm using the popular roles/profiles methodology, so all nodes have exactly 
one role::<something> class.  I want to get the <something> into a fact.

I've managed to get it working easily enough, but either not automatically 
or only on subsequent puppet runs (ie not the first).  This makes perfect 
sense, given the work flow of collect-facts -> compile catalog -> 
send-catalog-to-host.

My next attempt is to write a server-side function that can analyse the 
catalog after it's been built, extract the class names, find one that 
matches /^role::/ and bob's your uncle.

I'm having trouble getting started though - can anyone help me out with how 
I might get access to the catalog?  Is there a variable I can lookup, or a 
function or something?

Is the catalog even available, or are functions run before compilation?  Is 
there any way I can access a list of classes being applied?


I don't want to require something be done by developers (for example, 
putting the logic it in role.pp and require all roles to inherit that), as 
that leaves too much room for mistakes.  I really want it to be 
automatically done on all hosts, and available from the first run.


I'm not married to parsing the catalog - the end goal here is just getting 
the fact - any other ideas welcome.



Thoughts?

-- 
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/30a90fe7-61cc-483f-a7d4-e674d7df49c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to