Share Pastebin
Guest
Public paste!

Monachus

By: a guest | Feb 18th, 2010 | Syntax: None | Size: 0.72 KB | Hits: 37 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. class global::network {
  2.  
  3.         # the variables $ip and $netmask would be used by the template (change as needed)
  4.         define network_handler( $ip, $netmask ) {
  5.                 file { "ifcfg-${name}":
  6.                         path => "/etc/sysconfig/network-scripts/ifcfg-${name}",
  7.                         content => template("/your/template"),
  8.                 }
  9.  
  10.                 exec { "reload_${name}":
  11.                         command => "/bin/logger 'puppet-${name}',
  12.                         refreshonly => true,
  13.                         subscribe => File["ifcfg-${name}"],
  14.                 }
  15.         }
  16. }
  17.  
  18. class network {
  19.         include global::network
  20.  
  21.         # set up bond0.3
  22.         network_handler { "bond0.3":
  23.                 ip => "192.168.0.10",
  24.                 netmask => "255.255.255.0",
  25.         }
  26.  
  27.         # set up bond0.4
  28.         network_handler { "bond0.4":
  29.                 ip => "192.168.0.20",
  30.                 netmask => "255.255.255.0",
  31.         }
  32. }