1 # vswitch: open-vswitch
4 $package_ensure = 'present'
7 include 'vswitch::params'
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 }
16 case $::operatingsystem {
18 $ovs_status = '/sbin/status openvswitch-switch | fgrep "start/running"'
21 $ovs_status = '/etc/init.d/openvswitch-switch status | fgrep "is running"'
24 service {'openvswitch':
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
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'],
41 service {'openvswitch':
44 name => $::vswitch::params::ovs_service_name,
48 fail( "${::osfamily} not yet supported by puppet-vswitch")
52 package { $::vswitch::params::ovs_package_name:
53 ensure => $package_ensure,
54 before => Service['openvswitch'],
57 Service['openvswitch'] -> Vs_port<||>
58 Service['openvswitch'] -> Vs_bridge<||>