So far we've dealt mostly with strings and numbers, but Puppet has a couple of other data types you can use, which are ways of grouping values together: arrays and hashes.
We've encountered arrays before, when we used them to concisely declare several similar resources:
package { [ 'php5-cli', 'php5-fpm', 'php-pear' ]: ensure => installed, }
To make an array, all you need to do is put square brackets round it:
['jerry', 'george', 'elaine']
If you use an array in the context where a resource name is expected, this has the effect of declaring a resource for each member of the array:
$developers = ['jerry', 'george', 'elaine'] notify { $developers: }
The output from the preceding code snippet will be:
Notice: george Notice: jerry Notice: elaine
This is why the trick of declaring an array of package names works: it declares a package
resource for each member of the array.
However, this doesn't work if the array is interpolated into a string. In...