So my hiera variable looks like this.
I need to be able to iterate through contacts, grab the group name create a Nagios_contact group based on that value, then iterate through each group and create the contacts. How do I do this?
I tried something like below but it just doesn't work.
$contactdata.each | $groupname, $groupcontacts | {
$contactgroupname = $groupname[0]
nagios_contactgroup { "$contactgroupname":
ensure => present,
}
$groupcontacts.each | String $username, String $emailaddress | {
nagios_contact { "$username":
ensure => present,
contactgroups => "$groupdisplay",
email => "$emailaddress",
}
}