pupept environment filter

25 views
Skip to first unread message

Gustavo

unread,
Feb 12, 2020, 1:39:26 PM2/12/20
to Choria Users
Hi,

In old mcollective, we used puppet environment filters, because we generated facts.yaml with an ERB template using scope.to_hash, and could type, i.e.:

   mco find -F environment=dev 

Now with choria, I've noticed that generated-facts.yaml doesn't include puppet environment, because it is not a fact.

What is the recommended way to achieve this with choria? I'm thinking about a custom fact wich returns the configured puppet environment of the node.

Thanks!

R.I.Pienaar

unread,
Feb 12, 2020, 1:53:31 PM2/12/20
to choria-users
A custom fact might be your only option yes I am afraid, its a bit out of our control
--
You received this message because you are subscribed to the Google Groups "Choria Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to choria-users...@googlegroups.com.

--
R.I.Pienaar / www.devco.net / @ripienaar

Matt Cahill

unread,
Feb 12, 2020, 2:08:56 PM2/12/20
to choria...@googlegroups.com
Heed this warning when setting up your fact:


Overriding  $::environment may have unintended consequences. 

Also if you are using an external ENC and that is configured to control the environment that your clients are in then your cached fact can only be accurate to your puppet run interval rather than the choria facts.yaml generation interval. (Hope that makes sense)

Cheers

Matt

On 13/02/2020, at 07:53, R.I.Pienaar <r...@devco.net> wrote:



Gustavo Randich

unread,
Feb 13, 2020, 7:05:23 AM2/13/20
to choria...@googlegroups.com
Thanks Matt, R.I.

I suspected that risk, we’ll assume it because we are in full control of the nodes and don’t use ENC. Another option is to modify the facts.yaml generator script to make it extensible with custom logic, but it sounds cumbersome. 



R.I.Pienaar

unread,
Feb 13, 2020, 8:32:31 AM2/13/20
to choria-users
Yeah - for sure at that point we're just generating a new type of facts :P might as well use the actual fact system.
Reply all
Reply to author
Forward
0 new messages