forked from openstack/puppet-neutron
-
Notifications
You must be signed in to change notification settings - Fork 3
/
l3.pp
156 lines (149 loc) · 4.83 KB
/
l3.pp
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# == Class: neutron::agents::l3
#
# Installs and configures the Neutron L3 service
#
# TODO: create ability to have multiple L3 services
#
# === Parameters
#
# [*package_ensure*]
# (optional) The state of the package
# Defaults to present
#
# [*enabled*]
# (optional) The state of the service
# Defaults to true
#
# [*manage_service*]
# (optional) Whether to start/stop the service
# Defaults to true
#
# [*debug*]
# (optional) Print debug info in logs
# Defaults to false
#
# [*external_network_bridge*]
# (optional) The name of the external bridge
# Defaults to br-ex
#
# [*use_namespaces*]
# (optional) Enable overlapping IPs / network namespaces
# Defaults to false
#
# [*interface_driver*]
# (optional) Driver to interface with neutron
# Defaults to OVSInterfaceDriver
#
# [*router_id*]
# (optional) The ID of the external router in neutron
# Defaults to blank
#
# [*gateway_external_network_id*]
# (optional) The ID of the external network in neutron
# Defaults to blank
#
# [*handle_internal_only_routers*]
# (optional) L3 Agent will handle non-external routers
# Defaults to true
#
# [*metadata_port*]
# (optional) The port of the metadata server
# Defaults to 9697
#
# [*send_arp_for_ha*]
# (optional) Send this many gratuitous ARPs for HA setup. Set it below or equal to 0
# to disable this feature.
# Defaults to 3
#
# [*periodic_interval*]
# (optional) seconds between re-sync routers' data if needed
# Defaults to 40
#
# [*periodic_fuzzy_delay*]
# (optional) seconds to start to sync routers' data after starting agent
# Defaults to 5
#
# [*enable_metadata_proxy*]
# (optional) can be set to False if the Nova metadata server is not available
# Defaults to True
#
# [*network_device_mtu*]
# (optional) The MTU size for the interfaces managed by the L3 agent
# Defaults to undef
#
# [*router_delete_namespaces*]
# (optional) namespaces can be deleted cleanly on the host running the L3 agent
# Defaults to False
#
class neutron::agents::l3 (
$package_ensure = 'present',
$enabled = true,
$manage_service = true,
$debug = false,
$external_network_bridge = 'br-ex',
$use_namespaces = true,
$interface_driver = 'neutron.agent.linux.interface.OVSInterfaceDriver',
$router_id = undef,
$gateway_external_network_id = undef,
$handle_internal_only_routers = true,
$metadata_port = '9697',
$send_arp_for_ha = '3',
$periodic_interval = '40',
$periodic_fuzzy_delay = '5',
$enable_metadata_proxy = true,
$network_device_mtu = undef,
$router_delete_namespaces = false
) {
include neutron::params
Neutron_config<||> ~> Service['neutron-l3']
Neutron_l3_agent_config<||> ~> Service['neutron-l3']
neutron_l3_agent_config {
'DEFAULT/debug': value => $debug;
'DEFAULT/external_network_bridge': value => $external_network_bridge;
'DEFAULT/use_namespaces': value => $use_namespaces;
'DEFAULT/interface_driver': value => $interface_driver;
'DEFAULT/router_id': value => $router_id;
'DEFAULT/gateway_external_network_id': value => $gateway_external_network_id;
'DEFAULT/handle_internal_only_routers': value => $handle_internal_only_routers;
'DEFAULT/metadata_port': value => $metadata_port;
'DEFAULT/send_arp_for_ha': value => $send_arp_for_ha;
'DEFAULT/periodic_interval': value => $periodic_interval;
'DEFAULT/periodic_fuzzy_delay': value => $periodic_fuzzy_delay;
'DEFAULT/enable_metadata_proxy': value => $enable_metadata_proxy;
'DEFAULT/router_delete_namespaces': value => $router_delete_namespaces;
}
if $network_device_mtu {
neutron_l3_agent_config {
'DEFAULT/network_device_mtu': value => $network_device_mtu;
}
} else {
neutron_l3_agent_config {
'DEFAULT/network_device_mtu': ensure => absent;
}
}
if $::neutron::params::l3_agent_package {
Package['neutron-l3'] -> Neutron_l3_agent_config<||>
package { 'neutron-l3':
ensure => $package_ensure,
name => $::neutron::params::l3_agent_package,
require => Package['neutron'],
}
} else {
# Some platforms (RedHat) does not provide a neutron L3 agent package.
# The neutron L3 agent config file is provided by the neutron package.
Package['neutron'] -> Neutron_l3_agent_config<||>
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
service { 'neutron-l3':
ensure => $service_ensure,
name => $::neutron::params::l3_agent_service,
enable => $enabled,
require => Class['neutron'],
}
}