Thanks Gav,

It's a good idea, though on the surface I don't think it will work for us 
(we're trying to spin stuff up from a gold image using an ENC, and I think 
having an extra magic step in between is a greater evil than explicit 
declarations), but you've got me thinking down some other lines of 
automation.


On Thursday, January 28, 2016 at 4:55:11 PM UTC, Gavin Williams wrote:
>
> Gareth
>
> I've been working through the same issue internally here for a new Cloud 
> based platform, and came up with the solution of pre-loading the machine 
> with the role at the point the machine is provisioned. 
> Then when it first checks in with Puppet it's already for the fact 
> present... 
>
> Might be another option?
>
> Cheers
> Gav
>
> On Thursday, 28 January 2016 15:17:00 UTC, Gareth Humphries wrote:
>>
>> 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/120ceeb3-834a-43c2-89fd-7546dfceac21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to