bridge.pp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # bridge.pp
  2. #
  3. # === Parameters:
  4. #
  5. # [*ip*]
  6. # (mandatory) IP address of the bridge interface.
  7. #
  8. # [*netmask*]
  9. # (optional) Netmask of the bridge interface.
  10. # Defaults to '255.255.255.0' (/24).
  11. #
  12. define nova::network::bridge (
  13. $ip,
  14. $netmask = '255.255.255.0'
  15. ) {
  16. include ::nova::deps
  17. case $::osfamily {
  18. 'Debian': {
  19. $context = '/files/etc/network/interfaces'
  20. augeas { "bridge_${name}":
  21. context => $context,
  22. changes => [
  23. "set auto[child::1 = '${name}']/1 ${name}",
  24. "set iface[. = '${name}'] ${name}",
  25. "set iface[. = '${name}']/family inet",
  26. "set iface[. = '${name}']/method static",
  27. "set iface[. = '${name}']/address ${ip}",
  28. "set iface[. = '${name}']/netmask ${netmask}",
  29. "set iface[. = '${name}']/bridge_ports none",
  30. ],
  31. notify => Exec['networking-refresh'],
  32. }
  33. }
  34. 'RedHat' : {
  35. }
  36. default: { fail('nova::network_bridge currently only supports osfamily Debian and RedHat') }
  37. }
  38. }