Some of the Red Hat Enterprise Linux servers in our environment sometimes get assigned virtual IP addresses (eth0:1, eth0:2, etc). Puppet Dashboard''s parameters seem like an ideal way to define and provision virtual IPs on these servers. One could create a "vip1" parameter on a node, and define a value of the IP address to use for that vip. A manifest could then be written to create the necessary / etc/sysconfig/network-scripts/ifcfg-eth0:<vip#> file, plugging in the IP address appropriately and brining up the interface when it''s done. This could then be repeated for vip2 ... vipX. How might this work for an arbitrary number of vips? I don''t want to create unnecessary placeholder parameters (vip2 = nil, for example). I''d rather not create a single "vips" parameter with a list of virtual IPs either (vips = 1.1.1.1, 2.2.2.2, 3.3.3.3). Thanks! Scott -- 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.
Sandor W. Sklar
2011-Sep-28 02:28 UTC
[Puppet Users] Re: Dashboard parameters to control VIPs?
Perhaps I''m not understanding what you are asking, but I''ve got this class "network::interface": class network::interface( $device, $bootproto = ''static'', $hwaddr, $ipaddr, $ipv6init = ''yes'', $mtu = ''1500'', $netmask, $onboot = ''yes'' ) inherits network { # Create the device definition file file { "/etc/sysconfig/network-scripts/ifcfg-$device": content => template(''network/ifcfg.erb''), } # Ifdown and ifup the new interface upon changes exec { "ifdown-ifup-$device": user => ''root'', path => ''/etc/sysconfig/network-scripts:/bin:/usr/bin:/ sbin:/usr/sbin'', command => "/sbin/ifdown $device ; /sbin/ifup $device", refreshonly => true, subscribe => File["/etc/sysconfig/network-scripts/ifcfg- $device"], } } ... and the template: # This file is created by puppet # DO NOT HAND-EDIT DEVICE="<%= device %>" BOOTPROTO="<%= bootproto %>" <% if has_variable?("gateway") then -%> GATEWAY="<%= gateway %>" <% end -%> HWADDR="<%= hwaddr %>" IPADDR="<%= ipaddr %>" IPV6INIT="<%= ipv6init %>" MTU="<%= mtu %>" NETMASK="<%= netmask %>" ONBOOT="<%= onboot %>" Is this what you are looking for? -- 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.
Scott Merrill
2011-Sep-28 13:54 UTC
Re: [Puppet Users] Re: Dashboard parameters to control VIPs?
This is what I had in mind for part of this, yes. Thanks! Some more explanation of the situation and the goal: Some of our RHEL servers get assigned a virtual IP address for application-specific purposes. The first such vip is assigned to device eth0:1, the second vip to eth0:2, etc. Currently, adding a vip to a server requires us to ssh to the server, create the /etc/sysconfig/network-scripts/ifcfg-eth0:X file, add an entry for the vip to /etc/hosts, and manually bring up the defined interface. My current goal is to allow an operator to provision a new vip through Puppet Dashboard, using Dashboard''s parameters to define a key=>value relationship between a vip and its IP address. So, the first vip assigned to a server would get a parameter key of "vip1" with a parameter value of "1.1.1.1". At the next Puppet execution, the new vip will get provisioned automagically. A second could be be defined with "vip2"=>"2.2.2.2", etc. Because we don''t know in advance how many vips any server will have, I''m struggling with how to enumerate through an arbitrary number of parameters to discover all the ones named "vip?", such that the end state is that all of that server''s vips are configured and enabled. Thanks, Scott On Tue, Sep 27, 2011 at 10:28 PM, Sandor W. Sklar <ssklar@gmail.com> wrote:> Perhaps I''m not understanding what you are asking, but I''ve got this > class "network::interface": > > class network::interface( $device, > $bootproto = ''static'', > $hwaddr, > $ipaddr, > $ipv6init = ''yes'', > $mtu = ''1500'', > $netmask, > $onboot = ''yes'' ) inherits network { > > # Create the device definition file > file { "/etc/sysconfig/network-scripts/ifcfg-$device": > content => template(''network/ifcfg.erb''), > } > > # Ifdown and ifup the new interface upon changes > exec { "ifdown-ifup-$device": > user => ''root'', > path => ''/etc/sysconfig/network-scripts:/bin:/usr/bin:/ > sbin:/usr/sbin'', > command => "/sbin/ifdown $device ; /sbin/ifup $device", > refreshonly => true, > subscribe => File["/etc/sysconfig/network-scripts/ifcfg- > $device"], > } > > } > > ... and the template: > > > # This file is created by puppet > # DO NOT HAND-EDIT > DEVICE="<%= device %>" > BOOTPROTO="<%= bootproto %>" > <% if has_variable?("gateway") then -%> > GATEWAY="<%= gateway %>" > <% end -%> > HWADDR="<%= hwaddr %>" > IPADDR="<%= ipaddr %>" > IPV6INIT="<%= ipv6init %>" > MTU="<%= mtu %>" > NETMASK="<%= netmask %>" > ONBOOT="<%= onboot %>" > > Is this what you are looking for? > > -- > 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. > >-- 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.