I've got a simple puppet defined resource that looks like this:
define mything($number, $device, $otherthing) {
file{"/place/${number}":
ensure => directory
}
mount { "/place/${number}":
device => $device,
ensure => mounted,
require => File["/place/${number}"]
}
file {"/place/${number}/${otherthing}":
ensure => directory,
require => Mount['/place/${number}']
}
}
I need to call this resource a number of times with different parameters, but can't figure out how to do this without explicitly calling mything()
repeatedly.
Ideally, I'd have all the parameters for the stored in some sort of array, and then just call mything($array)
, a bit like this:
$array = [
{number => 3, something => 'yes', otherthing => 'whatever'},
{number => 17, something => 'ooo', otherthing => 'text'},
{number => 4, something => 'no', otherthing => 'random'},
]
mything($array)
But this doesn't appear to work. I'm fairly sure this would work if my resource only took a single parameter and I just had a flat array of values, but can I do the same thing with multiple named parameters?