I am having trouble getting parameterised classes working in puppet 2.6.4 (client and master)
######## from /etc/puppet/manifests/nodes.pp
# defining one node to use certain version
#######################################################
node 'dev-internal-000008.domain.com' {
include software($version="dev-2011.02.11")
}
# from /etc/puppet/modules/software/manifests/init.pp
I am setting the version here as the "default"
#class software($version="dev-2011.02.04b") {
File {
links => follow
}
file { "/opt/software_AIR":
ensure => directory
}
file { "/opt/software_AIR/share":
source => "puppet://puppet/software/air/$version",
recurse => "true",
}
}
#
errors from puppet master
#err: Could not parse for environment production: Syntax error at '='; expected ')' at /etc/puppet/manifests/nodes.pp:10 on node dev-internal-domain.com
#
found a fix for this
try
node 'dev-internal-000008.domain.com' {
class { customsoftware:version => "dev-2011.02.04b" }
}
Parameterized classes don't work with
include
, unfortunately. You have to use the new alternate class declaration syntax that was introduced at the same time as parameterized classes:Things:
file
,service
, etc.) declaration.include
. This is expected to change in 2.7, and some friendlier syntax will likely be introduced.You could also use a selector based on hostname: