]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/vswitch/manifests/ovs.pp
try again, with puppetforge modules, correctly included now
[dsa-puppet.git] / 3rdparty / modules / vswitch / manifests / ovs.pp
1 # vswitch: open-vswitch
2 #
3 class vswitch::ovs(
4   $package_ensure = 'present'
5 ) {
6
7   include 'vswitch::params'
8
9   case $::osfamily {
10     'Debian': {
11       # OVS doesn't build unless the kernel headers are present.
12       $kernelheaders_pkg = "linux-headers-${::kernelrelease}"
13       if ! defined(Package[$kernelheaders_pkg]) {
14         package { $kernelheaders_pkg: ensure => $package_ensure }
15       }
16       case $::operatingsystem {
17         'ubuntu': {
18           $ovs_status = '/sbin/status openvswitch-switch | fgrep "start/running"'
19         }
20         default: {
21           $ovs_status = '/etc/init.d/openvswitch-switch status | fgrep "is running"'
22         }
23       }
24       service {'openvswitch':
25         ensure      => true,
26         enable      => true,
27         name        => $::vswitch::params::ovs_service_name,
28         hasstatus   => false, # the supplied command returns true even if it's not running
29         # Not perfect - should spot if either service is not running - but it'll do
30         status      => $ovs_status
31       }
32       exec { 'rebuild-ovsmod':
33         command     => '/usr/sbin/dpkg-reconfigure openvswitch-datapath-dkms > /tmp/reconf-log',
34         creates     => "/lib/modules/${::kernelrelease}/updates/dkms/openvswitch_mod.ko",
35         require     => [Package['openvswitch-datapath-dkms', $kernelheaders_pkg]],
36         before      => Package['openvswitch-switch'],
37         refreshonly => true
38       }
39     }
40     'Redhat': {
41       service {'openvswitch':
42         ensure      => true,
43         enable      => true,
44         name        => $::vswitch::params::ovs_service_name,
45       }
46     }
47     default: {
48       fail( "${::osfamily} not yet supported by puppet-vswitch")
49     }
50   }
51
52   package { $::vswitch::params::ovs_package_name:
53     ensure  => $package_ensure,
54     before  => Service['openvswitch'],
55   }
56
57   Service['openvswitch'] -> Vs_port<||>
58   Service['openvswitch'] -> Vs_bridge<||>
59 }