vioilly
2013-Mar-08 10:16 UTC
[Puppet Users] multiple pamameter values in puppet dashboard ENC
Is there a way to use send multiple parameter values using puppet dashboard ENC? For example, nameserver = 10.0.0.1, 10.0.0.2 or perhaps nameserver = [''10.0.0.1'',''10.0.0.2''} then the template erb file can loop through each of the nameserver values to set up mulitple nameservers in resolve.conf? 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.
OlliesDad@googlemail.com
2013-Mar-08 10:52 UTC
[Puppet Users] Re: multiple pamameter values in puppet dashboard ENC
On Friday, March 8, 2013 10:16:37 AM UTC, vioilly wrote:> > Is there a way to use send multiple parameter values using puppet > dashboard ENC? > > For example, > > nameserver = 10.0.0.1, 10.0.0.2 > > or perhaps > > nameserver = [''10.0.0.1'',''10.0.0.2''} > > then the template erb file can loop through each of the nameserver values > to set up mulitple nameservers in resolve.conf? > >Don''t use the dashboard as an ENC (use extlookup/hiera) but the ERB looks something like this. With a split on whitespace:- # # The below is generated by Puppet template from <%= @module_name %> module: domain <%= scope.lookupvar(''resolver::params::domainname'') %> search <%= scope.lookupvar(''resolver::params::searchpath'') %> <% scope.lookupvar(''resolver::params::resolvers'').split(/\s+/).each do | ns | -%> nameserver <%= ns %> <% end -%> So however you get your key/value pairs should be fine. -- 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.
vioilly
2013-Mar-08 11:41 UTC
[Puppet Users] Re: multiple pamameter values in puppet dashboard ENC
Thanks for the reply. I have been told to use puppet dashboard as an ENC as I believe the reason is it will be the easiest way for the people looking after this. I managed to get this working - in puppet dashboard, supply the params with a delimiter. ie nameservers = 10.0.0.1,10.0.0.2 Then in the erb, i am using this code. <% name_servers.split('','').each do |ns| %>nameserver <%= ns %> <% end -%> Which is very similar to your suggestion. Thanks again... Oli --> > Don''t use the dashboard as an ENC (use extlookup/hiera) but the ERB looks > something like this. With a split on whitespace:- > > # > # The below is generated by Puppet template from <%= @module_name %> > module: > domain <%= scope.lookupvar(''resolver::params::domainname'') %> > search <%= scope.lookupvar(''resolver::params::searchpath'') %> > <% scope.lookupvar(''resolver::params::resolvers'').split(/\s+/).each do | > ns | -%> > nameserver <%= ns %> > <% end -%> > > So however you get your key/value pairs should be fine. >-- 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.