Hi all, I''ll use puppet to manage +/- 10 servers, but I''m facing some problems about facter variables, dashboard and parameters. I try to use this module : http://projects.puppetlabs.com/projects/1/wiki/Resolv_Conf_Patterns class resolver { # noop } define resolv_conf($domainname = "$domain", $searchpath, $nameservers) { file { "/etc/resolv.conf": owner => root, group => root, mode => 644, content => template("resolver/resolv.conf.erb"), } } with this template : domain <%= domainname %> <% if !searchpath.empty? %>search <%= searchpath.join(" ") %> <% end -%> <% nameservers.each do |ns| %>nameserver <%= ns %> <% end -%> But ... I wish to pass the parameters via the dashboard and use facter as source. For exemple : searchpath $domain <-- returned by facter in the inventory. The problem is the define keyword, the class is never taken into account in the dashboard. Could you help me ? Many thanks -- 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.
Sorry, forgot to include relevant infos : I''m using puppet 2.6.13 from epel repository with dashboard 1.2.6 On Feb 27, 3:56 pm, Smith <gilles6...@gmail.com> wrote:> Hi all, > > I''ll use puppet to manage +/- 10 servers, but I''m facing some problems > about facter variables, dashboard and parameters. > > I try to use this module : > > http://projects.puppetlabs.com/projects/1/wiki/Resolv_Conf_Patterns > > class resolver { > # noop > > } > > define resolv_conf($domainname = "$domain", $searchpath, $nameservers) > { > file { "/etc/resolv.conf": > owner => root, > group => root, > mode => 644, > content => template("resolver/resolv.conf.erb"), > } > > } > > with this template : > > domain <%= domainname %> > <% if !searchpath.empty? %>search <%= searchpath.join(" ") %> > <% end -%> > <% nameservers.each do |ns| %>nameserver <%= ns %> > <% end -%> > > But ... I wish to pass the parameters via the dashboard and use facter > as source. > > For exemple : > > searchpath $domain <-- returned by facter in the inventory. > > The problem is the define keyword, the class is never taken into > account in the dashboard. > > Could you help me ? > > Many thanks-- 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.
I have a script that I exec every puppet run that contacts a web site to fetch a version number for a program then compares it to the installed version number to determine if they match. If they match the script exits, if they don''t match it downloads a tarball and runs a somewhat complex set of installation steps. The tarball, version number and installation script are all maintained by another process. I don''t really want to take over that responsibility as this all works to my satisfaction however the exec in dashboard is seen as a change even when the script exits 0 after the check. Is there a way to exec a script without it being seen as a change in dashboard or is there possibly another way to do this? -- 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.
Nan Liu
2012-Feb-27 17:26 UTC
Re: [Puppet Users] Puppet-dashboard and successful exec = change
On Mon, Feb 27, 2012 at 8:34 AM, psyber <psyber0@gmail.com> wrote:> I have a script that I exec every puppet run that contacts a web site to > fetch a version number for a program then compares it to the installed > version number to determine if they match. If they match the script exits, > if they don''t match it downloads a tarball and runs a somewhat complex set > of installation steps. The tarball, version number and installation script > are all maintained by another process. I don''t really want to take over that > responsibility as this all works to my satisfaction however the exec in > dashboard is seen as a change even when the script exits 0 after the check. > Is there a way to exec a script without it being seen as a change in > dashboard or is there possibly another way to do this?That''s what unless and onlyif attributes are intended for in exec. exec { ''install_software'': command => ''complex_script'', unless => ''check_installation'', } HTH, Nan -- 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.
Nan Liu
2012-Feb-27 17:50 UTC
Re: [Puppet Users] About dashboard with parameterized classes
On Mon, Feb 27, 2012 at 6:56 AM, Smith <gilles6339@gmail.com> wrote:> Hi all, > > I''ll use puppet to manage +/- 10 servers, but I''m facing some problems > about facter variables, dashboard and parameters. > > I try to use this module : > > http://projects.puppetlabs.com/projects/1/wiki/Resolv_Conf_PatternsThat example is out of date in terms of best practices, modules should be written without requiring import function.> class resolver { > # noop > } > > define resolv_conf($domainname = "$domain", $searchpath, $nameservers) > { > file { "/etc/resolv.conf": > owner => root, > group => root, > mode => 644, > content => template("resolver/resolv.conf.erb"), > } > }There''s no reason for the configuration to be a define since there''s one specific file /etc/resolv.conf. The parameter should be part of the class and looked up from top scope which will allow you to specify the class and parameter in dashboard. This is probably a better starting point: https://github.com/saz/puppet-resolv_conf, and you''ll need to either change the module to accept parameters from top scope or write a wrapper class that passes the parameter from dashboard. Thanks, Nan -- 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.
Hello, Thanks for the info ! But what I''m trying to do is to pass parameters from the dashboard to the class. For example the following : class ntp ($ntp_servers) { ... } Add this class to dashboard, in a group called "Global" and set in this group a parameter key = ntp_servers with value = some.ntp.server Maybe this is here that I''m wrong, here is my site.pp cat /etc/puppet/manifests/site.pp node default { } All classes and nodes are managed through the dashboard. Thanks, G. On Feb 27, 6:50 pm, Nan Liu <n...@puppetlabs.com> wrote:> On Mon, Feb 27, 2012 at 6:56 AM, Smith <gilles6...@gmail.com> wrote: > > Hi all, > > > I''ll use puppet to manage +/- 10 servers, but I''m facing some problems > > about facter variables, dashboard and parameters. > > > I try to use this module : > > >http://projects.puppetlabs.com/projects/1/wiki/Resolv_Conf_Patterns > > That example is out of date in terms of best practices, modules should > be written without requiring import function. > > > class resolver { > > # noop > > } > > > define resolv_conf($domainname = "$domain", $searchpath, $nameservers) > > { > > file { "/etc/resolv.conf": > > owner => root, > > group => root, > > mode => 644, > > content => template("resolver/resolv.conf.erb"), > > } > > } > > There''s no reason for the configuration to be a define since there''s > one specific file /etc/resolv.conf. The parameter should be part of > the class and looked up from top scope which will allow you to specify > the class and parameter in dashboard. > > This is probably a better starting point:https://github.com/saz/puppet-resolv_conf, and you''ll need to either > change the module to accept parameters from top scope or write a > wrapper class that passes the parameter from dashboard. > > Thanks, > > Nan-- 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.
Kenneth Lo
2012-Feb-29 15:39 UTC
Re: [Puppet Users] Re: About dashboard with parameterized classes
We have a similar setup. The way we do this is to simply enforce as a procedure to create a group and each class we declared, then we would reference the class in that group, and create variables under that group. From dashboard''s organization standpoint we would only assign nodes to a group (instead of class) Note that variables create from dashboard are global as far as I know, so we would just use naming convention to make things easier. --KL On 2/29/12 5:37 AM, "Smith" <gilles6339@gmail.com> wrote:>Hello, > >Thanks for the info ! >But what I''m trying to do is to pass parameters from the dashboard to >the class. > >For example the following : > >class ntp ($ntp_servers) { >... >} > >Add this class to dashboard, in a group called "Global" and set in >this group a parameter key = ntp_servers with value = some.ntp.server > >Maybe this is here that I''m wrong, here is my site.pp > >cat /etc/puppet/manifests/site.pp >node default { >} > >All classes and nodes are managed through the dashboard. > >Thanks, > >G. > > > > >On Feb 27, 6:50 pm, Nan Liu <n...@puppetlabs.com> wrote: >> On Mon, Feb 27, 2012 at 6:56 AM, Smith <gilles6...@gmail.com> wrote: >> > Hi all, >> >> > I''ll use puppet to manage +/- 10 servers, but I''m facing some problems >> > about facter variables, dashboard and parameters. >> >> > I try to use this module : >> >> >http://projects.puppetlabs.com/projects/1/wiki/Resolv_Conf_Patterns >> >> That example is out of date in terms of best practices, modules should >> be written without requiring import function. >> >> > class resolver { >> > # noop >> > } >> >> > define resolv_conf($domainname = "$domain", $searchpath, $nameservers) >> > { >> > file { "/etc/resolv.conf": >> > owner => root, >> > group => root, >> > mode => 644, >> > content => template("resolver/resolv.conf.erb"), >> > } >> > } >> >> There''s no reason for the configuration to be a define since there''s >> one specific file /etc/resolv.conf. The parameter should be part of >> the class and looked up from top scope which will allow you to specify >> the class and parameter in dashboard. >> >> This is probably a better starting >>point:https://github.com/saz/puppet-resolv_conf, and you''ll need to >>either >> change the module to accept parameters from top scope or write a >> wrapper class that passes the parameter from dashboard. >> >> Thanks, >> >> Nan > >-- >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. >This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. -- 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.
Nan Liu
2012-Feb-29 17:55 UTC
Re: [Puppet Users] Re: About dashboard with parameterized classes
On Wed, Feb 29, 2012 at 2:37 AM, Smith <gilles6339@gmail.com> wrote:> Hello, > > Thanks for the info ! > But what I''m trying to do is to pass parameters from the dashboard to > the class. > > For example the following : > > class ntp ($ntp_servers) { > ... > }You need either a wrapper class class ntp::wrapper { class { ntp: ntp_server => $::ntp_servers, } } or class ntp ( $ntp_servers = $::ntp_servers ) { ... }> Add this class to dashboard, in a group called "Global" and set in > this group a parameter key = ntp_servers with value = some.ntp.serverThis should work with the class above. Thanks, Nan -- 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.