Re: [Puppet Users] Templating DHCP3-Server Need To Loop Through Subnets

2012-04-26 Thread Greg Sutcliffe
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu 26 Apr 2012 17:24:17 BST, Brian Carpio wrote:
> $subnet = [ 192.168.10.0, 192.168.20.0, 192.168.30.0 ]
> $range = [ 192.168.10.115 192.168.10.120 ]

Sounds like you need a Hash here:

$subnets = { '192.168.10.0' => '192.168.10.115 192.168.10.120',
 '192.168.20.0' => '192.168.20.105
192.168.20.130',
  }

Then access it with something like:

<% subnets.each do |subnet,range| -%>
subnet <%= subnet %>
  range <%= range %>
<% end -%>

Hope that helps,
Greg
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+ZexQACgkQ8O7RN8oK65P3DACeNr38heQ8cILSbEgbGW1CMhng
ESsAniVsAJpfAoWklmCk+6qDCAwji/7d
=M9cK
-END PGP SIGNATURE-

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Templating DHCP3-Server Need To Loop Through Subnets

2012-04-26 Thread Brian Carpio
I know the title doesn't define what I am trying to do very well but
this is what I'd like to accomplish.

I have a params.pp which defines the subnets I would like to have
setup in my .dhcpd.conf.erb, but default the dhcpd.conf looks like
this:


subnet 192.168.10.0 netmask 255.255.255.0 {
  range 192.168.10.115 192.168.10.120;
  option broadcast-address 192.168.10.255;
  option routers 192.168.10.1;
  option subnet-mask 255.255.255.0;
  option domain-name-servers 192.168.10.12;
option domain-name "arch.ecollege.com";
  filename "pxelinux.0";
  next-server 192.168.10.133;
}

But I'd like to make this in such a way that in my params.pp I have a
subnet variable like

$subnet = [ 192.168.10.0, 192.168.20.0, 192.168.30.0 ]

You get the idea, but for 192.168.10.0 I want to define the range, so:

$range = [ 192.168.10.115 192.168.10.120 ]

But I also want to define the range for 192.168.20.0 which might be a
different range then the 192.168.10 subnet..


I started with


<% scope.lookupvar('dhcp3-server::params::subnet').each do |var| -%>
subnet <%= var %> netmask 255.255.255.0 {
range ??

I'm not sure how to define the range for the 192.168.10 subnet vs the
192.168.20 subnet without having to build the file manually.

Maybe this isn't possible? Any help is greatly appreciated.


-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.