]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/neutron/manifests/agents/l3.pp
try again, with puppetforge modules, correctly included now
[dsa-puppet.git] / 3rdparty / modules / neutron / manifests / agents / l3.pp
1 # == Class: neutron::agents::l3
2 #
3 # Installs and configures the Neutron L3 service
4 #
5 # TODO: create ability to have multiple L3 services
6 #
7 # === Parameters
8 #
9 # [*package_ensure*]
10 #   (optional) The state of the package
11 #   Defaults to present
12 #
13 # [*enabled*]
14 #   (optional) The state of the service
15 #   Defaults to true
16 #
17 # [*manage_service*]
18 #   (optional) Whether to start/stop the service
19 #   Defaults to true
20 #
21 # [*debug*]
22 #   (optional) Print debug info in logs
23 #   Defaults to false
24 #
25 # [*external_network_bridge*]
26 #   (optional) The name of the external bridge
27 #   Defaults to br-ex
28 #
29 # [*use_namespaces*]
30 #   (optional) Enable overlapping IPs / network namespaces
31 #   Defaults to false
32 #
33 # [*interface_driver*]
34 #   (optional) Driver to interface with neutron
35 #   Defaults to OVSInterfaceDriver
36 #
37 # [*router_id*]
38 #   (optional) The ID of the external router in neutron
39 #   Defaults to blank
40 #
41 # [*gateway_external_network_id*]
42 #   (optional) The ID of the external network in neutron
43 #   Defaults to blank
44 #
45 # [*handle_internal_only_routers*]
46 #   (optional) L3 Agent will handle non-external routers
47 #   Defaults to true
48 #
49 # [*metadata_port*]
50 #   (optional) The port of the metadata server
51 #   Defaults to 9697
52 #
53 # [*send_arp_for_ha*]
54 #   (optional) Send this many gratuitous ARPs for HA setup. Set it below or equal to 0
55 #   to disable this feature.
56 #   Defaults to 3
57 #
58 # [*periodic_interval*]
59 #   (optional) seconds between re-sync routers' data if needed
60 #   Defaults to 40
61 #
62 # [*periodic_fuzzy_delay*]
63 #   (optional) seconds to start to sync routers' data after starting agent
64 #   Defaults to 5
65 #
66 # [*enable_metadata_proxy*]
67 #   (optional) can be set to False if the Nova metadata server is not available
68 #   Defaults to True
69 #
70 # [*network_device_mtu*]
71 #   (optional) The MTU size for the interfaces managed by the L3 agent
72 #   Defaults to undef
73 #   Should be deprecated in the next major release in favor of a global parameter
74 #
75 # [*router_delete_namespaces*]
76 #   (optional) namespaces can be deleted cleanly on the host running the L3 agent
77 #   Defaults to False
78 #
79 # [*ha_enabled*]
80 #   (optional) Enabled or not HA for L3 agent.
81 #   Defaults to false
82 #
83 # [*ha_vrrp_auth_type*]
84 #   (optional) VRRP authentication type. Can be AH or PASS.
85 #   Defaults to "PASS"
86 #
87 # [*ha_vrrp_auth_password*]
88 #   (optional) VRRP authentication password. Required if ha_enabled = true.
89 #   Defaults to undef
90 #
91 # [*ha_vrrp_advert_int*]
92 #   (optional) The advertisement interval in seconds.
93 #   Defaults to '2'
94 #
95 # [*agent_mode*]
96 #   (optional) The working mode for the agent.
97 #   'legacy': default behavior (without DVR)
98 #   'dvr': enable DVR for an L3 agent running on compute node (DVR in production)
99 #   'dvr_snat': enable DVR with centralized SNAT support (DVR for single-host, for testing only)
100 #   Defaults to 'legacy'
101 #
102 # [*allow_automatic_l3agent_failover*]
103 #   (optional) Automatically reschedule routers from offline L3 agents to online
104 #   L3 agents.
105 #   This is another way to run virtual routers in highly available way but with slow
106 #   failover performances compared to Keepalived feature in Neutron L3 Agent.
107 #   Defaults to 'False'
108 #
109 class neutron::agents::l3 (
110   $package_ensure                   = 'present',
111   $enabled                          = true,
112   $manage_service                   = true,
113   $debug                            = false,
114   $external_network_bridge          = 'br-ex',
115   $use_namespaces                   = true,
116   $interface_driver                 = 'neutron.agent.linux.interface.OVSInterfaceDriver',
117   $router_id                        = undef,
118   $gateway_external_network_id      = undef,
119   $handle_internal_only_routers     = true,
120   $metadata_port                    = '9697',
121   $send_arp_for_ha                  = '3',
122   $periodic_interval                = '40',
123   $periodic_fuzzy_delay             = '5',
124   $enable_metadata_proxy            = true,
125   $network_device_mtu               = undef,
126   $router_delete_namespaces         = false,
127   $ha_enabled                       = false,
128   $ha_vrrp_auth_type                = 'PASS',
129   $ha_vrrp_auth_password            = undef,
130   $ha_vrrp_advert_int               = '3',
131   $agent_mode                       = 'legacy',
132   $allow_automatic_l3agent_failover = false,
133 ) {
134
135   include neutron::params
136
137   Neutron_config<||>          ~> Service['neutron-l3']
138   Neutron_l3_agent_config<||> ~> Service['neutron-l3']
139
140   if $ha_enabled {
141     neutron_l3_agent_config {
142       'DEFAULT/ha_vrrp_auth_type':     value => $ha_vrrp_auth_type;
143       'DEFAULT/ha_vrrp_auth_password': value => $ha_vrrp_auth_password;
144       'DEFAULT/ha_vrrp_advert_int':    value => $ha_vrrp_advert_int;
145     }
146   }
147
148   neutron_l3_agent_config {
149     'DEFAULT/debug':                            value => $debug;
150     'DEFAULT/external_network_bridge':          value => $external_network_bridge;
151     'DEFAULT/use_namespaces':                   value => $use_namespaces;
152     'DEFAULT/interface_driver':                 value => $interface_driver;
153     'DEFAULT/router_id':                        value => $router_id;
154     'DEFAULT/gateway_external_network_id':      value => $gateway_external_network_id;
155     'DEFAULT/handle_internal_only_routers':     value => $handle_internal_only_routers;
156     'DEFAULT/metadata_port':                    value => $metadata_port;
157     'DEFAULT/send_arp_for_ha':                  value => $send_arp_for_ha;
158     'DEFAULT/periodic_interval':                value => $periodic_interval;
159     'DEFAULT/periodic_fuzzy_delay':             value => $periodic_fuzzy_delay;
160     'DEFAULT/enable_metadata_proxy':            value => $enable_metadata_proxy;
161     'DEFAULT/router_delete_namespaces':         value => $router_delete_namespaces;
162     'DEFAULT/agent_mode':                       value => $agent_mode;
163     'DEFAULT/allow_automatic_l3agent_failover': value => $allow_automatic_l3agent_failover;
164   }
165
166   if $network_device_mtu {
167     warning('The neutron::l3_agent::newtork_device_mtu parameter is deprecated, use neutron::newtork_device_mtu instead.')
168     neutron_l3_agent_config {
169       'DEFAULT/network_device_mtu':           value => $network_device_mtu;
170     }
171   } else {
172     warning('The neutron::l3_agent::newtork_device_mtu parameter is deprecated, use neutron::newtork_device_mtu instead.')
173     neutron_l3_agent_config {
174       'DEFAULT/network_device_mtu':           ensure => absent;
175     }
176   }
177
178   if $::neutron::params::l3_agent_package {
179     Package['neutron-l3'] -> Neutron_l3_agent_config<||>
180     package { 'neutron-l3':
181       ensure  => $package_ensure,
182       name    => $::neutron::params::l3_agent_package,
183       require => Package['neutron'],
184     }
185   } else {
186     # Some platforms (RedHat) does not provide a neutron L3 agent package.
187     # The neutron L3 agent config file is provided by the neutron package.
188     Package['neutron'] -> Neutron_l3_agent_config<||>
189   }
190
191   if $manage_service {
192     if $enabled {
193       $service_ensure = 'running'
194     } else {
195       $service_ensure = 'stopped'
196     }
197   }
198
199   service { 'neutron-l3':
200     ensure  => $service_ensure,
201     name    => $::neutron::params::l3_agent_service,
202     enable  => $enabled,
203     require => Class['neutron'],
204   }
205 }