try again, with puppetforge modules, correctly included now
[mirror/dsa-puppet.git] / 3rdparty / modules / neutron / manifests / agents / linuxbridge.pp
1 # == Class: neutron::agents::linuxbridge
2 #
3 # Setups linuxbridge neutron agent.
4 #
5 # === Parameters
6 #
7 # [*physical_interface_mappings*]
8 #   (required) Comma-separated list of <physical_network>:<physical_interface>
9 #   tuples mapping physical network names to agent's node-specific physical
10 #   network interfaces.
11 #
12 # [*firewall_driver*]
13 #   (optional) Firewall driver for realizing neutron security group function.
14 #   Defaults to 'neutron.agent.linux.iptables_firewall.IptablesFirewallDriver'.
15 #
16 # [*package_ensure*]
17 #   (optional) Ensure state for package. Defaults to 'present'.
18 #
19 # [*enable*]
20 #   (optional) Enable state for service. Defaults to 'true'.
21 #
22 # [*manage_service*]
23 #   (optional) Whether to start/stop the service
24 #   Defaults to true
25 #
26 class neutron::agents::linuxbridge (
27   $physical_interface_mappings,
28   $firewall_driver = 'neutron.agent.linux.iptables_firewall.IptablesFirewallDriver',
29   $package_ensure  = 'present',
30   $enable          = true,
31   $manage_service  = true
32 ) {
33
34   include neutron::params
35
36   Neutron_config<||>             ~> Service['neutron-plugin-linuxbridge-service']
37   Neutron_plugin_linuxbridge<||> ~> Service<| title == 'neutron-plugin-linuxbridge-service' |>
38
39   if $::neutron::params::linuxbridge_agent_package {
40     Package['neutron'] -> Package['neutron-plugin-linuxbridge-agent']
41     Package['neutron-plugin-linuxbridge-agent'] -> Neutron_plugin_linuxbridge<||>
42     Package['neutron-plugin-linuxbridge-agent'] -> Service['neutron-plugin-linuxbridge-service']
43     package { 'neutron-plugin-linuxbridge-agent':
44       ensure => $package_ensure,
45       name   => $::neutron::params::linuxbridge_agent_package,
46     }
47   } else {
48     # Some platforms (RedHat) do not provide a separate neutron plugin
49     # linuxbridge agent package. The configuration file for the linuxbridge
50     # agent is provided by the neutron linuxbridge plugin package.
51     Package['neutron-plugin-linuxbridge'] -> Neutron_plugin_linuxbridge<||>
52
53     if ! defined(Package['neutron-plugin-linuxbridge']) {
54       package { 'neutron-plugin-linuxbridge':
55         ensure  => $package_ensure,
56         name    => $::neutron::params::linuxbridge_server_package,
57       }
58     }
59   }
60
61   neutron_plugin_linuxbridge {
62     'LINUX_BRIDGE/physical_interface_mappings': value => $physical_interface_mappings;
63     'SECURITYGROUP/firewall_driver':            value => $firewall_driver;
64   }
65
66   if $manage_service {
67     if $enable {
68       $service_ensure = 'running'
69     } else {
70       $service_ensure = 'stopped'
71     }
72   }
73
74   service { 'neutron-plugin-linuxbridge-service':
75     ensure  => $service_ensure,
76     name    => $::neutron::params::linuxbridge_agent_service,
77     enable  => $enable,
78   }
79 }