i have heard of people using json in fact values to express arrays.  

On Monday, December 2, 2013 8:25:20 AM UTC-5, Matthias Saou wrote:
>
> On Sun, 1 Dec 2013 20:58:34 -0800 (PST) 
> Shiva Narayanaswamy <shiva.nar...@gmail.com <javascript:>> wrote: 
>
> > I want to implement a scenario where I can mix and match multiple 
> > roles on any managed node. The particular roles played by a node are 
> > available as facts (role1=webserver, role2=appserver etc )In 
> > development all the roles will be played by one host, and in 
> > production a server might play only one role. 
> > 
> > I was hoping there will be some way I can implement this in hiera. 
> > Any clues or pointers would be much appreciated. 
>
> I've already had to do something similar, and did it the following way : 
>
>  * A single "role=" fact/variable. 
>  * Conditionals such as "if "<rolename>" in $role { ..." 
>
> It's not the prettiest way, but since facts can't be arrays, it's the 
> best I could think of. My role names are all 3 letter long and unique, 
> meaning that no role name contains another (role "app" and "app1" 
> would cause "app" to be found in "app1). 
>
> In hiera (or from a fact) I just need to have a role string : 
>
> role: 'role1,role2,role3' 
>
> Depending on your environment, it might also make sense to go for 
> completely separate variables for each role, such as: 
>
> webserver: true 
> appserver: true 
>
> With matching facts which exist or don't exist. 
>
> HTH, 
> Matthias 
>
> -- 
>             Matthias Saou                  ██          ██ 
>                                              ██      ██ 
> Web: http://matthias.saou.eu/              ██████████████ 
> Mail/XMPP:  matt...@saou.eu <javascript:>             ████  ██████  ████ 
>                                        ██████████████████████ 
> 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/4b2f9b22-7386-4da7-bb57-07f55e375cd9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to