I have a simple puppet specific 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 several times with different parameters, but I canβt figure out how to do this without repeating repeatedly calling mything() .
Ideally, I will have all the options to store in some kind of array, and then just call mything($array) , a little like this:
$array = [ {number => 3, something => 'yes', otherthing => 'whatever'}, {number => 17, something => 'ooo', otherthing => 'text'}, {number => 4, something => 'no', otherthing => 'random'}, ] mything($array)
But that does not work. I'm sure this will work if my resource took only one parameter, and I just had a flat array of values, but can I do the same with a few named parameters?
source share