Re: [Puppet Users] CF3 to PE 3.3 - Hiera Question

2014-08-08 Thread Matthias Saou
Hi,

With hiera, you'll need to base all of your logic on fact values.
AFAIK, you can't directly use any regexps, but what you could do to
achieve to same goal is create a custom fact which would get assigned a
specific value if another fact matches a regexp.

Another other solution would be unconditionally include a class, and
have the logic inside that class, to include other classes based on
things like "if $::hostname =~ /^web\d+$/ { include '::foo' }".

Combine the ifs as much as you want, using intermediate booleans to
make things clearer...

HTH,
Matthias

On Wed, 6 Aug 2014 10:22:22 -0700 (PDT)
Tom Tucker  wrote:

> 
> I’m in the process of migrating from CFEngine 3 to PE 3.3 so please
> pardon me if my terminology is off.
> 
> With CFEngine I could build arrays, define a hostname regex  or
> define network segment variables to gain further control.  How do you
> do this with Hiera?
> 
> CFEngine Examples
> ###
> "web_regex" expression => classmatch("^web\d+$")
> "mail_servers_array" or => { mailA, mailB, mailC, someSYS, someSYS2}; 
> "DC1_DEV_NET" or => { ipv4_10_225_172 };
> "DC2_QA_NET" or => { ipv4_10_224_136 };
> 
> For example….
> If your hostname matches the “web_regex” and you reside in the
> DC2_QA_NET then do X, Y and Z.
> 
> Thanks in advance for your time and assistance.  
> 
> Tom
> 



-- 
Matthias Saou  ██  ██
 ██  ██
Web: http://matthias.saou.eu/  ██
Mail/XMPP:  matth...@saou.eu   ██  
   ██
GPG: 4096R/E755CC63██  ██  ██
 8D91 7E2E F048 9C9C 46AF  ██  ██  ██  ██
 21A9 7A51 7B82 E755 CC63  

-- 
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/20140808123306.132a29fe%40r2d2.marmotte.net.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] CF3 to PE 3.3 - Hiera Question

2014-08-06 Thread Tom Tucker

I’m in the process of migrating from CFEngine 3 to PE 3.3 so please pardon 
me if my terminology is off.

With CFEngine I could build arrays, define a hostname regex  or define 
network segment variables to gain further control.  How do you do this with 
Hiera?

CFEngine Examples
###
"web_regex" expression => classmatch("^web\d+$")
"mail_servers_array" or => { mailA, mailB, mailC, someSYS, someSYS2}; 
"DC1_DEV_NET" or => { ipv4_10_225_172 };
"DC2_QA_NET" or => { ipv4_10_224_136 };

For example….
If your hostname matches the “web_regex” and you reside in the DC2_QA_NET 
 then do X, Y and Z.

Thanks in advance for your time and assistance.  

Tom

-- 
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/1b81679f-ef7e-4711-be43-012db728ce5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.