hi ch Huang,
Here in this case you have to use parameterised class concept. Refer
http://docs.puppetlabs.com/guides/parameterized_classes.html for
parameterised classes concept.
You can restructure your manifests to solve your issue.
Refer following manifests,
*init.pp file*
here we pass the *master* parameter to class and inherits params class.
class hadoop (
$master = $hadoop::params::master,
) inherits hadoop::params {
file { "/tmp/conftest":
ensure => 'file',
content => "${master}",
}
}
*node.pp*
node 'default' {
class {"hadoop":
# pass the master parameter to hadoop class it will override the
value present in the params file,
# if we are not passing the master parameter then it take default
value present in the params.pp file
master => 'mymaster',
}
}
node 'bm' inherits 'default' {
}
*params.pp*
class hadoop::params {
$master = $::hostname ? {
default => 'HM',
}
}
Hope this would help.
Thanks and Regards,
Rahul Khengare,
NTT DATA OSS Center, Pune, India.
On Tuesday, September 24, 2013 11:51:29 AM UTC+5:30, ch huang wrote:
>
> i expect the file /tmp/conftest content will be "mymaster" not default
> "HM" on node bm ,but fail,anyone can help?
>
> here my init.pp
>
> class hadoop {
> require hadoop::params
> file { "/tmp/conftest":
> ensure => 'file',
> content => "$hadoop::params::master",
> }
> }
> here my node.pp
>
> node 'default' {
> include hadoop
> }
> node 'bm' inherits 'default' {
> $hadoop::params::master = 'mymaster'
> }
>
> here is my params.pp
>
> class hadoop::params {
> $master = $::hostname ? {
> default => 'HM',
> }
> }
>
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.