This originally started out as a question, but then I figured out the
answer (or should I say, "an answer"), so I'm sharing in the hopes
that this helps someone else out.

Suppose you have two packages that you want to ensure are installed,
and then use a require later on. I did it like this:

package { [foo, bar]:
    ensure => installed
}

file {"/tmp/example.txt":
    require => Package[foo,bar],
    content => "Sample content"
}

However, if you then decide to add package "baz", you have to add it
in multiple places, which isn't a good idea. I'd rather edit it in one
single place.

The solution is to store the package names in an array.

$packages = [ foo, bar ]

package { $packages:
    ensure => installed
}

file {"/tmp/example.txt":
    require => Package[ $packages ],
    content => "Sample content"
}

Now you can add package baz in the $packages definition, and away you go.

Pete

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to