On Sun, 1 Dec 2013 20:58:34 -0800 (PST)
Shiva Narayanaswamy <[email protected]> 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: [email protected] ████ ██████ ████
██████████████████████
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/20131202142520.300f2ca4%40r2d2.marmotte.net.
For more options, visit https://groups.google.com/groups/opt_out.