vioilly
2013-Mar-11 21:28 UTC
[Puppet Users] using parameter with puppet dashboard and site.pp
I have just set up my puppet dashboard to be used as a ENC. This is for the time being the easiest way to get support guys to add nodes to classes. I have to use global parameters in my modules if I would like to declare parameters using dashboard as the ENC. So I have a module which does this: class resolver ($domain_name=$::domainname, $search_path=$::searchpath, $name_servers=$::nameservers, ){ if ($name_servers == undef) { fail(''ensure at least the namesever parameter is defined'') } ... The 3 global parameters can be passed in using dashboard ENC. I have a requirement to add a name_server parameter, which inherits the $::nameservers parameter. How would I use a global parameter if I wanted to specify classes in the site.pp file? Many thanks - Oli -- 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 post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
jcbollinger
2013-Mar-13 13:44 UTC
[Puppet Users] Re: using parameter with puppet dashboard and site.pp
On Monday, March 11, 2013 4:28:19 PM UTC-5, vioilly wrote:> > I have just set up my puppet dashboard to be used as a ENC. This is for > the time being the easiest way to get support guys to add nodes to classes. > I have to use global parameters in my modules if I would like to declare > parameters using dashboard as the ENC. >What are class parameters actually doing for you, then? Is there any case in which they do not take their default values? And does Dashboard really not support specifying class parameter values directly? I''ve never been much of a fan of parameterized classes, but even so, that would constitute a pretty big feature hole.> > So I have a module which does this: > > > class resolver ($domain_name=$::domainname, > $search_path=$::searchpath, > $name_servers=$::nameservers, ){ > > if ($name_servers == undef) { > fail(''ensure at least the namesever parameter is defined'') > } > > ... > > The 3 global parameters can be passed in using dashboard ENC. I have a > requirement to add a name_server parameter, which inherits the > $::nameservers parameter. > >There are no global "parameters", only global variables. Also, variables and parameters don''t ever inherit anything from anywhere. It matters, because I''m left uncertain what you''re actually asking. Do you mean that you want to add a parameter $::resolver::name_server to class resolver, and that it should default to the value of $::nameservers in the event that no explicit value is set? Or do you mean that you want to add a global variable $::name_server that will have the same value as $::nameservers if you do not explicitly assign a value to it via Dashboard? Or maybe something else?> How would I use a global parameter if I wanted to specify classes in the > site.pp file? > >I don''t understand the question. Do you mean you want to declare class ''resolver'' at top scope (which will cause it to be applied to all nodes), or do you mean that you will declared it in a node block that appears in site.pp? What is it about global variables vis a vis what you want to do that makes you uncertain how to proceed? 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 post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.