10 Jul 2012 11:21
[Puppet Users] Array mapping
Jonathan Gazeley <jonathan.gazeley <at> bristol.ac.uk>
2012-07-10 09:21:18 GMT
2012-07-10 09:21:18 GMT
Hi all,
I'm aware that using a "define" can be used to create multiple resources
from a list of items, like this:
define print {
notify{"the message is: ${name}": }
}
print{["one", "two", "three"]: }
This would be the same as making these resources by hand:
notify{"the message is: one": }
notify{"the message is: two": }
notify{"the message is: three": }
Some of my facter variables are formatted as a comma-separated list of
network interfaces, and of system disks. I wish to create separate
Nagios checks for each. When I reference the variable like this, the
individual entries from the list are not treated as an array, but as a
concatenated string.
notify{ [$diskdrives]: }
So how can I get Puppet to treat each disk and network interface
separately in the loop and generate multiple Nagios checks?
Thanks,
Jonathan
(Continue reading)
RSS Feed