I have a list of databases and a list of users. I want to to grant
privileges on each database to each user, for a total of # databases x
# users. I'd rather not write out the grant snippet for each unique
combination, but rather define the databases as an array of values
along with the users as an array of values, and then iterate over
their cross-product. However, I'm finding this tricky to do in
Puppet.
The main way to perform iteration in Puppet seems to be the Array as
$name trick:
file { ['a','b','c']: ... } is expanded to file {'a':..}, file
{'b': ...}, file {'c': ...}
I'm not sure how I can make this trick worth with a cross-product of
two arrays. Something like:
define outer_loop($inner_values) {
inner_loop { $inner_values:
outer_value => $name
}
}
define inner_loop($outer_value) {
# perform op on ${outer_value} + ${name}
}
Doesn't work, because the call to inner_loop in each iteration of the
array results in duplicate definition instantiations. I know I'm not
supposed to think of definitions as functions, but is there some way
of getting the desired before I'm looking for?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---