Ugo Bellavance
2012-Dec-07 16:49 UTC
[Puppet Users] Module class parameter override question
Hi, I am experimenting with foreman''s apache module and there is this class here: class apache::service { $http_service = $::operatingsystem ? { /(Debian|Ubuntu)/ => ''apache2'', default => ''httpd'', } service { $http_service: ensure => running, enable => true, hasstatus => true, hasrestart => true, alias => ''httpd'', subscribe => Package[''httpd''] } exec { ''reload-apache'': command => "/etc/init.d/${http_service} reload", onlyif => ''/usr/sbin/apachectl -t'', require => Service[''httpd''], refreshonly => true, } } I want to apply this class to a specific host, but I want to override the enable parameter so that it is false. I tried this: node ''server1'' { class { ''apache::service'': enable => false,} } But I always get this error: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid parameter enable at /etc/puppet/manifests/nodes/nodes.pp:40 Any help would be appreciated. Thanks, Ugo -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/CFRXiqvj8cAJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Ugo Bellavance
2012-Dec-07 19:37 UTC
[Puppet Users] Re: Module class parameter override question
I realize that maybe these modules have been built to be used only with foreman. Is that a decent assumption? And if so, is there a simple apache module somewhere? I only want to do the basics, check packages, service, and create vhosts. I may be better writing my own... On Friday, December 7, 2012 11:49:19 AM UTC-5, Ugo Bellavance wrote:> > Hi, > > I am experimenting with foreman''s apache module and there is this class > here: > > class apache::service { > $http_service = $::operatingsystem ? { > /(Debian|Ubuntu)/ => ''apache2'', > default => ''httpd'', > } > > service { $http_service: > ensure => running, > enable => true, > hasstatus => true, > hasrestart => true, > alias => ''httpd'', > subscribe => Package[''httpd''] > } > > exec { ''reload-apache'': > command => "/etc/init.d/${http_service} reload", > onlyif => ''/usr/sbin/apachectl -t'', > require => Service[''httpd''], > refreshonly => true, > } > > } > > I want to apply this class to a specific host, but I want to override the > enable parameter so that it is false. > > I tried this: > > node ''server1'' { > class { ''apache::service'': > enable => false,} > } > > But I always get this error: > > Could not retrieve catalog from remote server: Error 400 on SERVER: > Invalid parameter enable at /etc/puppet/manifests/nodes/nodes.pp:40 > > Any help would be appreciated. > > Thanks, > > Ugo >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/bLajZTaZ-McJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Friday, December 7, 2012 1:37:20 PM UTC-6, Ugo Bellavance wrote:> > I realize that maybe these modules have been built to be used only with > foreman. Is that a decent assumption? And if so, is there a simple apache > module somewhere? I only want to do the basics, check packages, service, > and create vhosts. I may be better writing my own... >Yes, the foreman* modules are designed to be used as a set to install foreman. As for what to use, take a look at the puppet module forge, puppetlabs has a module for apache. I generally look at the forge, give modules a read, then either hack it or write my own.> > On Friday, December 7, 2012 11:49:19 AM UTC-5, Ugo Bellavance wrote: >> >> Hi, >> >> I am experimenting with foreman''s apache module and there is this class >> here: >> >> class apache::service { >> $http_service = $::operatingsystem ? { >> /(Debian|Ubuntu)/ => ''apache2'', >> default => ''httpd'', >> } >> >> service { $http_service: >> ensure => running, >> enable => true, >> hasstatus => true, >> hasrestart => true, >> alias => ''httpd'', >> subscribe => Package[''httpd''] >> } >> >> exec { ''reload-apache'': >> command => "/etc/init.d/${http_service} reload", >> onlyif => ''/usr/sbin/apachectl -t'', >> require => Service[''httpd''], >> refreshonly => true, >> } >> >> } >> >> I want to apply this class to a specific host, but I want to override the >> enable parameter so that it is false. >> >> I tried this: >> >> node ''server1'' { >> class { ''apache::service'': >> enable => false,} >> } >> >> But I always get this error: >> >> Could not retrieve catalog from remote server: Error 400 on SERVER: >> Invalid parameter enable at /etc/puppet/manifests/nodes/nodes.pp:40 >> >> Any help would be appreciated. >> >> Thanks, >> >> Ugo >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Jr2mF3O8dCMJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Ohad Levy
2012-Dec-07 19:56 UTC
Re: [Puppet Users] Re: Module class parameter override question
On Fri, Dec 7, 2012 at 9:37 PM, Ugo Bellavance <ugob@lubik.ca> wrote:> I realize that maybe these modules have been built to be used only with > foreman. Is that a decent assumption? And if so, is there a simple apache > module somewhere? I only want to do the basics, check packages, service, > and create vhosts. I may be better writing my own... > >Ideally we would like to share & reuse the modules as much as possible, they are not aimed to work just for the installer ( a lot of people use them for a lot of different usage cases). specifically, you tried to override a class that has no param class attached to it. saying that, we are going a process of parameteriziing all of our classes, so if you would like to send a patch / pull request we would gladly accept. Ohad> > On Friday, December 7, 2012 11:49:19 AM UTC-5, Ugo Bellavance wrote: >> >> Hi, >> >> I am experimenting with foreman''s apache module and there is this class >> here: >> >> class apache::service { >> $http_service = $::operatingsystem ? { >> /(Debian|Ubuntu)/ => ''apache2'', >> default => ''httpd'', >> } >> >> service { $http_service: >> ensure => running, >> enable => true, >> hasstatus => true, >> hasrestart => true, >> alias => ''httpd'', >> subscribe => Package[''httpd''] >> } >> >> exec { ''reload-apache'': >> command => "/etc/init.d/${http_service} reload", >> onlyif => ''/usr/sbin/apachectl -t'', >> require => Service[''httpd''], >> refreshonly => true, >> } >> >> } >> >> I want to apply this class to a specific host, but I want to override the >> enable parameter so that it is false. >> >> I tried this: >> >> node ''server1'' { >> class { ''apache::service'': >> enable => false,} >> } >> >> But I always get this error: >> >> Could not retrieve catalog from remote server: Error 400 on SERVER: >> Invalid parameter enable at /etc/puppet/manifests/nodes/**nodes.pp:40 >> >> Any help would be appreciated. >> >> Thanks, >> >> Ugo >> > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/bLajZTaZ-McJ. > > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Ugo Bellavance
2012-Dec-08 01:31 UTC
Re: [Puppet Users] Re: Module class parameter override question
On Friday, December 7, 2012 2:56:30 PM UTC-5, ohad wrote:> > > > > On Fri, Dec 7, 2012 at 9:37 PM, Ugo Bellavance <ug...@lubik.ca<javascript:> > > wrote: > >> I realize that maybe these modules have been built to be used only with >> foreman. Is that a decent assumption? And if so, is there a simple apache >> module somewhere? I only want to do the basics, check packages, service, >> and create vhosts. I may be better writing my own... >> >> > Ideally we would like to share & reuse the modules as much as possible, > they are not aimed to work just for the installer ( a lot of people use > them for a lot of different usage cases). > > specifically, you tried to override a class that has no param class > attached to it. > >Hmmm, I kind of understand the concept, but wouldn''t know how to fix the module as of now.> saying that, we are going a process of parameteriziing all of our > classes, so if you would like to send a patch / pull request we would > gladly accept. > >Ok, I''ll do my best. One of our devs spent a few hours today to puppet-lint the module, generate the doc and make it standard compliant. I currently get errors on the metadata.json files, but when I get something stable I''ll send it to you (I''m not familiar with git, pull requests or even patches). Thanks, Ugo -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/ikxg2vahDBoJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jason Cochard
2012-Dec-11 20:47 UTC
[Puppet Users] Re: Module class parameter override question
This class does not accept any parameters, thus why it is failing. You could easily modify it though to do so: class apache::service ( $enable = "true",) { ...snip... service { $http_service: ensure => running, enable => *$enable*, hasstatus => true, hasrestart => true, alias => ''httpd'', subscribe => Package[''httpd''] } ...snip... Then call it like this on the node: node ''server1'' { class { "apache::service": enable => "false" } } Side note, when there is only one parameter, the best practice is to put it all on one line. On Friday, December 7, 2012 8:49:19 AM UTC-8, Ugo Bellavance wrote:> > Hi, > > I am experimenting with foreman''s apache module and there is this class > here: > > class apache::service { > $http_service = $::operatingsystem ? { > /(Debian|Ubuntu)/ => ''apache2'', > default => ''httpd'', > } > > service { $http_service: > ensure => running, > enable => true, > hasstatus => true, > hasrestart => true, > alias => ''httpd'', > subscribe => Package[''httpd''] > } > > exec { ''reload-apache'': > command => "/etc/init.d/${http_service} reload", > onlyif => ''/usr/sbin/apachectl -t'', > require => Service[''httpd''], > refreshonly => true, > } > > } > > I want to apply this class to a specific host, but I want to override the > enable parameter so that it is false. > > I tried this: > > node ''server1'' { > class { ''apache::service'': > enable => false,} > } > > But I always get this error: > > Could not retrieve catalog from remote server: Error 400 on SERVER: > Invalid parameter enable at /etc/puppet/manifests/nodes/nodes.pp:40 > > Any help would be appreciated. > > Thanks, > > Ugo >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/2k_xWFaMUAoJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Ugo Bellavance
2012-Dec-12 02:15 UTC
Re: [Puppet Users] Re: Module class parameter override question
On Tue, Dec 11, 2012 at 3:47 PM, Jason Cochard <jason.cochard@gmail.com>wrote:> This class does not accept any parameters, thus why it is failing. You > could easily modify it though to do so: > > class apache::service ( $enable = "true",) > { > > ...snip... > > service { $http_service: > ensure => running, > enable => *$enable*, > hasstatus => true, > hasrestart => true, > alias => ''httpd'', > subscribe => Package[''httpd''] > } > ...snip... > > Then call it like this on the node: > node ''server1'' { > class { "apache::service": enable => "false" } > } > >Wow, with just that, I''ll be able to do that with all my modules that need to accept parameters.> > Side note, when there is only one parameter, the best practice is to put > it all on one line. >Ok, I wonder if puppet-lint would have caught that. Thanks a lot, Ugo -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.