Created
April 9, 2012 18:59
-
-
Save ranguard/2345549 to your computer and use it in GitHub Desktop.
How to use the same list in puppet for multiple locations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$perl_modules = [ 'Data::Pageset', 'perl-module-b' ] | |
perlbrew::install_modules { | |
$perl_modules: | |
perl => 'a-version-of-perl' | |
} | |
perlbrew::install_modules { | |
$perl_modules: | |
perl => 'a-different-version-of-perl' | |
} | |
# or even something like | |
perlbrew::install_modules { | |
'some-name-1': | |
perl => "a-version-of-perl", | |
toinstall => $perl_modules, | |
} | |
perlbrew::install_modules { | |
'some-name-2': | |
perl => "a-second-of-perl", | |
toinstall => $perl_modules, | |
} | |
but it's then how to go through the list and merge with the 'perl' | |
to create a unique identifier which can be passed to a method | |
along with the module name that I'm not sure on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
define pkgInstall() {
file { "${title}":
ensure => file,
source => "/modules/perlbrew/files/${title}.tgz",
}
}
$list1 = PackageList("perl_version_one", 'install')
pkgInstall{ $list1: }
$list2 = PackageList("perl_version_two", 'install')
pkgInstall{ $list2: }
<-- cut here, remainder goes into lib/puppet/parser/functions/PackageList.rb -->
PackageList - generate a list of packages based upon a prefix (or set of prefixes)
This function allows us to manage packages using prefixes set in extlookup. This
method gives us very fine-grained control of packages, without requiring a ton of
"package" declarations.
module Puppet::Parser::Functions
newfunction(:PackageList, :type => :rvalue) do |args|
prefixes = args[0]
infix = args[1]
prefixList = prefixes.split("|")
end
vi:tabstop=4:expandtab:ai