An ENC can be used to insert a sort of "Puppet Master defined Fact" (which is 
actually a top scope variable/parameter) before catalog compilation. Note that 
this will never appear in "facter -p" on the Agents, because it's not really a 
Fact.

Code:

https://gist.github.com/lukebigum/20231e70545a298b7dc5

And the data file looks like:

[root@master ~]# head -n10 /etc/puppet/roles.yaml 
#Managed by Puppet
---
host.example.com:
  parameters:
    role: woof
server.example.com:
  parameters:
    role: cows

--
Luke Bigum
Senior Systems Engineer

Information Systems


----- Original Message -----
From: "Hubert Schmoll" <hubertschm...@googlemail.com>
To: "Puppet Users" <puppet-users@googlegroups.com>
Cc: s...@tetralog.de
Sent: Friday, 4 December, 2015 9:31:33 AM
Subject: [Puppet Users] Custom facts per node.. only via 
/etc/facter/facts.d/fact_xyz.txt per node?

Hello everyone,

here's what i wanna accomplish: 
i am havin 4 so called servergroups

- ci
- dev
- stage
- production

and i want them to have specific facts depending on the group they are in. 
so in every node i created a file /etc/facter/facts.d/servergroup.txt, 
containing e.g.
*servergroup=stage* 

where then a 

*facter -d servergroup *in the clienthost
gives me an:

*stage *

on puppet master, my hiera.yaml looks like this:

:hierarchy:
  - "servergroup/%{::servergroup}"
  - "nodes/%{::clientcert}"
  - common

and i've got on my hieradata a folder servergroup with an file stage.yaml, 
which, then again, holds:

message: '***           Preparing STAGE environment           ***'
repo_stage_enabled: '1'
repo_prod_enabled:  '0'
nrpe_allowed_hosts: '192.168.3.4'

my module which installes a nrpe uses then these values. like:

$nrpe_allowed_hosts     = hiera('nrpe_allowed_hosts')


so far this works, every stage node gets this values, productive of ci 
nodes get different values. all good.
What  i do not like is that i have on each node to create the file 
"/etc/facter/facts.d/servergroup.txt".

I'd rather like to have this information which servergroup each node 
belongs on my puppetmaster. 

Any ideas? Use ENC? Create kinda custom facts on the puppet master ?

Thanks and best regards

Hubert

-- 
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/07ef5bc5-a62a-4b0a-950e-50f0d16b3491%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
---

LMAX Exchange, Yellow Building, 1A Nicholas Road, London W11 4AN
http://www.LMAX.com/

#1 Fastest Growing Tech Company in the UK - Sunday Times Tech Track 100 (2014) 

2015 Best Margin Sector Platform - Profit & Loss Readers' Choice Awards
2015 Best FX Trading Venue - ECN/MTF - WSL Institutional Trading Awards
2014 Best Margin Sector Platform - Profit & Loss Readers' Choice Awards
2014 Best FX Trading Venue - ECN/MTF - WSL Institutional Trading Awards
2014 Best Infrastructure/Technology Initiative - WSL Institutional Trading 
Awards
2013 #15 Fastest Growing Tech Company in the UK - Sunday Times Tech Track 100
2013 Best Overall Testing Project - The European Software Testing Awards
2013 Best Margin Sector Platform - Profit & Loss Readers' Choice Awards
2013 Best FX Trading Platform - ECN/MTF - WSL Institutional Trading Awards
2013 Best Executing Venue - Forex Magnates Awards

---

FX and CFDs are leveraged products that can result in losses exceeding your 
deposit. They are not suitable for everyone so please ensure you fully 
understand the risks involved.

This message and its attachments are confidential, may not be disclosed or used 
by any person other than the addressee and are intended only for the named 
recipient(s). This message is not intended for any recipient(s) who based on 
their nationality, place of business, domicile or for any other reason, is/are 
subject to local laws or regulations which prohibit the provision of such 
products and services. This message is subject to the following terms 
(http://lmax.com/pdf/general-disclaimers.pdf), if you cannot access these, 
please notify us by replying to this email and we will send you the terms. If 
you are not the intended recipient, please notify the sender immediately and 
delete any copies of this message.

LMAX Exchange is the trading name of LMAX Limited. LMAX Limited operates a 
multilateral trading facility. LMAX Limited is authorised and regulated by the 
Financial Conduct Authority (firm registration number 509778) and is a company 
registered in England and Wales (number 6505809).

LMAX Hong Kong Limited is a wholly-owned subsidiary of LMAX Limited. LMAX Hong 
Kong is licensed by the Securities and Futures Commission in Hong Kong to 
conduct Type 3 (leveraged foreign exchange trading) regulated activity with CE 
Number BDV088.

-- 
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/992458416.10508227.1449243229604.JavaMail.zimbra%40lmax.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to