I''m trying to figure out if I can pass multiple variables from puppet,
into
a template, and have them iterate out. I''m using puppet to configure
Varnish and I want to pass it 3 pieces of information repeatedly: The
domain name, what the backend should be, and if it should force SSL. Can I
just do something like:
varnish::config { "something" :
sites => [
["one.domain.com", "apache", "false"],
["two.domain.com", "apache", "false"],
["secure.domain.com", "lighttpd", "true"] ]
}
And if that works, how do I iterate through that in the template?
Thanks
-Jon
PS. Or is there a better way to go about this that I''m missing?
--
Jon
[[User:ShakataGaNai]] / KJ6FNQ
http://snowulf.com/
http://www.linkedin.com/in/shakataganai <http://twitter.com/shakataganai>
--
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.
Felix Frank
2011-Dec-07 12:51 UTC
Re: [Puppet Users] Multi-Dimensional Arrays and Templates?
On 11/21/2011 07:11 PM, Jon Davis wrote:> PS. Or is there a better way to go about this that I''m missing?I''m not sure that it *will* work, in fact. It may be beneficial to put your information into a hash-based structure instead, such as { domainname => { ''servertype'' => servertype, ''flag'' => boolean } } HTH, Felix -- 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 is something I am using, and I''m sure it could be split into even
more
levels:
manifest:
$allowed_ips = {
"Example IP address" => {"11.22.33.44" =>
"22"}
}
template:
<% allowed_ips.each do |comment, ip_port| -%>
<% ip_port.each do |ip, port| -%>
$IPT -A INPUT -s <%= ip %> --dport <%= port %> -j ACCEPT #
<%= comment
%>
<% end -%>
<% end -%>
Hope it helps.
--
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/-/uX3QoWK4z4IJ.
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.