----- Original Message -----
> Hi all,
> 
> One of my facter variables returns an array of disks presently
> connected
> to the system. I want to have something in my manifest that loops
> around
> the array and adds a Nagios check for each disk.
> 
> In perlish pseudocode, I imagine something like this:
> 
> @disks = sda,sdb,sdc
> 
> foreach $disk in @disks {
>          @@nagios_service { "check_disk_${disk}":
>                  check_command => "check_disk!${disk}",
>                  host_name => "$fqdn",
>                  service_description => "Disk ${disk} status",
>          }
> }
> 
>  From what I can gather, a straightforward foreach isn't possible in
> puppet 2.6.6. Is there a workaround or a better way of achieving
> this?

If you made a defined type you can do it.

here's a very simple one that loops an array and create 'notify' resources:

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": }

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to