Yuriy Gerasimov
2013-Dec-13 11:03 UTC
[Puppet Users] Pass variable to class from hiera puppetlabs-apache
Hi, I am cleaning my manifest by moving things to hiera yaml config file. For the https://github.com/puppetlabs/puppetlabs-apache I need to pass mpm_module variable as false like: class { ''apache'': mpm_module => false } But I can''t figure out how to do this in hiera yaml file. I include classes using hiera_include(''classes''). I tried classes: - apache - apache::mpm_module: false - apache::mod::prefork - apache::mod::php - apache::mod::rewrite - apache::mod::ssl But I get error Error: undefined method `downcase'' for {"apache::mpm_module"=>false}:Hash at /tmp/vagrant-puppet/manifests/site.pp:13 on node precise64.asus Please advise how properly pass variables to classes in yaml files? Thank you a lot Yuriy -- 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 puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/53358b67-e54d-4d4a-988f-3f8139bbf830%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Paul Archer
2013-Dec-13 22:13 UTC
[Puppet Users] Re: Pass variable to class from hiera puppetlabs-apache
The classes indicator/variable/key (whatever it''s officially called) is only for classes. Then in the appropriate yaml file, specify: apache::mpm_module: false or whatever. It''s that easy. So your file should look like: classes: - apache apache::mpm_module: false apache::mod::prefork: true apache::mod::php: this apache::mod::rewrite: that apache::mod::ssl: "the other" On Friday, December 13, 2013 5:03:17 AM UTC-6, Yuriy Gerasimov wrote:> > Hi, > > I am cleaning my manifest by moving things to hiera yaml config file. > > For the https://github.com/puppetlabs/puppetlabs-apache I need to > pass mpm_module variable as false like: > > class { ''apache'': > mpm_module => false > } > > But I can''t figure out how to do this in hiera yaml file. I include > classes using hiera_include(''classes''). > > I tried > > classes: > - apache > - apache::mpm_module: false > - apache::mod::prefork > - apache::mod::php > - apache::mod::rewrite > - apache::mod::ssl > > But I get error > > Error: undefined method `downcase'' for {"apache::mpm_module"=>false}:Hash > at /tmp/vagrant-puppet/manifests/site.pp:13 on node precise64.asus > > Please advise how properly pass variables to classes in yaml files? > > Thank you a lot > > Yuriy >-- 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 puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/36e6635a-4508-4aa5-86d6-dd3ad3279c8e%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
jcbollinger
2013-Dec-16 14:23 UTC
[Puppet Users] Re: Pass variable to class from hiera puppetlabs-apache
On Friday, December 13, 2013 4:13:22 PM UTC-6, Paul Archer wrote:> > The classes indicator/variable/key (whatever it''s officially called) is > only for classes. > Then in the appropriate yaml file, specify: > apache::mpm_module: false > or whatever. It''s that easy. > > So your file should look like: > > classes: > - apache > > apache::mpm_module: false > apache::mod::prefork: true > apache::mod::php: this > apache::mod::rewrite: that > apache::mod::ssl: "the other" > >Exactly so. The latter part is an exercise of Puppet 3''s automatic data binding feature, and it is applicable to any of the available mechanisms by which you can declare classes, either directly or indirectly. Class parameter values defined that way in your hiera hierarchy will be effective whether you ''include'', ''require'', or ''contain'' (coming soon) a class, or if you declare it via hiera_include() or another function. They will be effective also if you use parameterized-style class declarations, except that parameter values declared explicitly in such a declaration override hiera data. John -- 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 puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/cf50de7f-510f-41ad-9e71-33f422a4f812%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.