Defined Type: openstack::neutron::bridge

Defined in:
modules/openstack/manifests/neutron/bridge.pp

Overview

Parameters:

  • addif (Any) (defaults to: undef)
  • ensure (Any) (defaults to: 'present')


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'modules/openstack/manifests/neutron/bridge.pp', line 1

define openstack::neutron::bridge(
    $addif=undef,
    $ensure='present',
    ) {

    if ($ensure == 'present') {

        exec {"create-${name}-bridge":
            command => "/sbin/brctl addbr ${name}",
            unless  => "/sbin/brctl show | /bin/grep ${name}",
        }

        # this is hokey but solves the simple case for neutron at the moment
        if ($addif) {
            exec { "create-${name}-bridge-${addif}":
                command   => "/sbin/brctl addif ${name} ${addif}",
                unless    => "/sbin/brctl show ${name} | /bin/grep ${addif}",
                subscribe => Exec["create-${name}-bridge"],
            }

            # if the interface is managed by Puppet, ensure it's created first
            Exec <| tag == "interface-create-${addif}" |>
                -> Exec["create-${name}-bridge-${addif}"]
        }
    }

    file { "/etc/network/interfaces.d/${name}":
        ensure    => $ensure,
        owner     => 'root',
        group     => 'root',
        mode      => '0644',
        content   => template('openstack/neutron/bridge.erb'),
        subscribe => Exec["create-${name}-bridge"],
    }
}