55637faa6f
Experimental support for FreeBSD. Requires a fairly recent version of FreeBSD with pkgng installed. The ovs commands remain exactly the same, however it is necessary to replace invocations of the ip command with and equivalent ifconfig command in FreeBSD. Also, appropriate setting of the datapath is also required to make a bridge actually appear as an interface. Specified the default expected parameters for vswitch::ovs when used under FreeBSD. Also, some minor changes were made to the vswitch::ovs parameters, most notably the addition of a status parameter for the required services (ovs-vswitchd,ovsdb-server). Change-Id: I4c3923d17ac04402ac94ccea01e1d8ffcb5c0e4f
105 lines
3.1 KiB
Puppet
105 lines
3.1 KiB
Puppet
# vswitch: open-vswitch
|
|
# == Class: vswitch::ovs
|
|
#
|
|
# installs openvswitch
|
|
#
|
|
# === Parameters:
|
|
#
|
|
# [*package_ensure*]
|
|
# (Optional) State of the openvswitch package
|
|
# Defaults to 'present'.
|
|
#
|
|
# [*dkms_ensure*]
|
|
# (optional) on debian/wheezy, ubuntu/precise, ubuntu/trusty and
|
|
# ubuntu/utopic dkms (Dynamic Kernel Module Support) is used to
|
|
# have a kernel module which matches the running kernel.
|
|
# In newer distributions (which ship with a newer kernel) dkms
|
|
# is not available anymore for openvswitch.
|
|
# For RedHat this parameter is ignored.
|
|
# If you like turn off dkms on Debian/Ubuntu set to
|
|
# false. defaults to true.
|
|
|
|
class vswitch::ovs(
|
|
$package_ensure = 'present',
|
|
$dkms_ensure = true,
|
|
) {
|
|
|
|
include ::vswitch::params
|
|
|
|
case $::osfamily {
|
|
'Debian': {
|
|
|
|
if $dkms_ensure {
|
|
package { $::vswitch::params::ovs_dkms_package_name:
|
|
ensure => $package_ensure,
|
|
}
|
|
# OVS doesn't build unless the kernel headers are present.
|
|
$kernelheaders_pkg = "linux-headers-${::kernelrelease}"
|
|
if ! defined(Package[$kernelheaders_pkg]) {
|
|
package { $kernelheaders_pkg: ensure => $package_ensure }
|
|
}
|
|
exec { 'rebuild-ovsmod':
|
|
command => '/usr/sbin/dpkg-reconfigure openvswitch-datapath-dkms > /tmp/reconf-log',
|
|
creates => "/lib/modules/${::kernelrelease}/updates/dkms/openvswitch_mod.ko",
|
|
require => [Package[$::vswitch::params::ovs_dkms_package_name , $kernelheaders_pkg]],
|
|
before => Package['openvswitch-switch'],
|
|
refreshonly => true,
|
|
}
|
|
}
|
|
|
|
case $::operatingsystem {
|
|
'ubuntu': {
|
|
$ovs_status = '/sbin/status openvswitch-switch | fgrep "start/running"'
|
|
}
|
|
default: {
|
|
$ovs_status = '/etc/init.d/openvswitch-switch status | fgrep "is running"'
|
|
}
|
|
}
|
|
service { 'openvswitch':
|
|
ensure => true,
|
|
enable => true,
|
|
name => $::vswitch::params::ovs_service_name,
|
|
hasstatus => false, # the supplied command returns true even if it's not running
|
|
# Not perfect - should spot if either service is not running - but it'll do
|
|
status => $ovs_status
|
|
}
|
|
}
|
|
'Redhat': {
|
|
service { 'openvswitch':
|
|
ensure => true,
|
|
enable => true,
|
|
name => $::vswitch::params::ovs_service_name,
|
|
}
|
|
}
|
|
'FreeBSD': {
|
|
Package {
|
|
provider => 'pkgng',
|
|
}
|
|
service { 'ovsdb-server':
|
|
ensure => true,
|
|
enable => true,
|
|
name => $::vswitch::params::ovsdb_service_name,
|
|
status => $::vswitch::params::ovsdb_status,
|
|
}
|
|
~>
|
|
service { 'openvswitch':
|
|
ensure => true,
|
|
enable => true,
|
|
name => $::vswitch::params::ovs_service_name,
|
|
status => $::vswitch::params::ovs_status,
|
|
}
|
|
}
|
|
default: {
|
|
fail( "${::osfamily} not yet supported by puppet-vswitch")
|
|
}
|
|
}
|
|
|
|
package { $::vswitch::params::ovs_package_name:
|
|
ensure => $package_ensure,
|
|
before => Service['openvswitch'],
|
|
}
|
|
|
|
Service['openvswitch'] -> Vs_port<||>
|
|
Service['openvswitch'] -> Vs_bridge<||>
|
|
}
|