2016-03-22 19:22:13 -04:00
|
|
|
# Configure the Neutron service
|
|
|
|
#
|
|
|
|
# [*driver*]
|
|
|
|
# (optional) Neutron Driver to test
|
|
|
|
# Can be: openvswitch or linuxbridge.
|
2016-12-16 13:57:41 +08:00
|
|
|
# Defaults to 'openvswitch'.
|
2016-05-24 22:30:55 -04:00
|
|
|
#
|
2016-03-22 19:22:13 -04:00
|
|
|
class openstack_integration::neutron (
|
2016-12-16 13:57:41 +08:00
|
|
|
$driver = 'openvswitch',
|
2016-03-22 19:22:13 -04:00
|
|
|
) {
|
2016-02-26 19:13:28 -05:00
|
|
|
|
2016-03-01 13:38:07 -05:00
|
|
|
include ::openstack_integration::config
|
2016-05-10 15:21:48 -04:00
|
|
|
include ::openstack_integration::params
|
|
|
|
|
|
|
|
if $::openstack_integration::config::ssl {
|
|
|
|
openstack_integration::ssl_key { 'neutron':
|
|
|
|
notify => Service['neutron-server'],
|
|
|
|
require => Package['neutron'],
|
|
|
|
}
|
|
|
|
Exec['update-ca-certificates'] ~> Service['neutron-server']
|
|
|
|
}
|
2015-12-23 22:54:56 +01:00
|
|
|
|
|
|
|
rabbitmq_user { 'neutron':
|
|
|
|
admin => true,
|
|
|
|
password => 'an_even_bigger_secret',
|
|
|
|
provider => 'rabbitmqctl',
|
|
|
|
require => Class['::rabbitmq'],
|
|
|
|
}
|
|
|
|
rabbitmq_user_permissions { 'neutron@/':
|
|
|
|
configure_permission => '.*',
|
|
|
|
write_permission => '.*',
|
|
|
|
read_permission => '.*',
|
|
|
|
provider => 'rabbitmqctl',
|
|
|
|
require => Class['::rabbitmq'],
|
|
|
|
}
|
2016-06-02 22:44:18 -04:00
|
|
|
Rabbitmq_user_permissions['neutron@/'] -> Service<| tag == 'neutron-service' |>
|
2015-12-23 22:54:56 +01:00
|
|
|
|
2016-03-22 19:22:13 -04:00
|
|
|
case $driver {
|
|
|
|
'openvswitch': {
|
|
|
|
include ::vswitch::ovs
|
|
|
|
# Functional test for Open-vSwitch:
|
|
|
|
# create dummy loopback interface to exercise adding a port to a bridge
|
|
|
|
vs_bridge { 'br-ex':
|
|
|
|
ensure => present,
|
|
|
|
notify => Exec['create_loop1_port'],
|
|
|
|
}
|
|
|
|
exec { 'create_loop1_port':
|
|
|
|
path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
|
|
|
provider => shell,
|
|
|
|
command => 'ip link add name loop1 type dummy && ip addr add 127.2.0.1/24 dev loop1',
|
|
|
|
refreshonly => true,
|
|
|
|
} ->
|
|
|
|
vs_port { 'loop1':
|
|
|
|
ensure => present,
|
|
|
|
bridge => 'br-ex',
|
|
|
|
notify => Exec['create_br-ex_vif'],
|
|
|
|
}
|
|
|
|
# creates br-ex virtual interface to reach floating-ip network
|
|
|
|
exec { 'create_br-ex_vif':
|
|
|
|
path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
|
|
|
provider => shell,
|
|
|
|
command => 'ip addr add 172.24.5.1/24 dev br-ex && ip link set br-ex up',
|
|
|
|
refreshonly => true,
|
|
|
|
}
|
|
|
|
class { '::neutron::agents::ml2::ovs':
|
2016-08-09 15:34:52 -04:00
|
|
|
local_ip => '127.0.0.1',
|
|
|
|
tunnel_types => ['vxlan'],
|
|
|
|
bridge_mappings => ['external:br-ex'],
|
|
|
|
manage_vswitch => false,
|
2016-03-22 19:22:13 -04:00
|
|
|
}
|
2016-12-16 13:57:41 +08:00
|
|
|
$firewall_driver = 'iptables_hybrid'
|
2016-03-22 19:22:13 -04:00
|
|
|
}
|
|
|
|
'linuxbridge': {
|
|
|
|
exec { 'create_dummy_iface':
|
|
|
|
path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
|
|
|
provider => shell,
|
|
|
|
unless => 'ip l show loop0',
|
|
|
|
command => 'ip link add name loop0 type dummy && ip addr add 172.24.5.1/24 dev loop0 && ip link set loop0 up',
|
|
|
|
}
|
|
|
|
class { '::neutron::agents::ml2::linuxbridge':
|
|
|
|
local_ip => $::ipaddress,
|
|
|
|
tunnel_types => ['vxlan'],
|
|
|
|
physical_interface_mappings => ['external:loop0'],
|
|
|
|
}
|
2016-12-16 13:57:41 +08:00
|
|
|
$firewall_driver = 'iptables'
|
2016-03-22 19:22:13 -04:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
fail("Unsupported neutron driver (${driver})")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-23 22:54:56 +01:00
|
|
|
class { '::neutron::db::mysql':
|
|
|
|
password => 'neutron',
|
|
|
|
}
|
|
|
|
class { '::neutron::keystone::auth':
|
2016-05-10 15:21:48 -04:00
|
|
|
public_url => "${::openstack_integration::config::base_url}:9696",
|
|
|
|
internal_url => "${::openstack_integration::config::base_url}:9696",
|
|
|
|
admin_url => "${::openstack_integration::config::base_url}:9696",
|
2016-03-02 19:09:05 -05:00
|
|
|
password => 'a_big_secret',
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
|
|
|
class { '::neutron':
|
2016-11-09 09:41:17 -07:00
|
|
|
default_transport_url => os_transport_url({
|
|
|
|
'transport' => 'rabbit',
|
|
|
|
'host' => $::openstack_integration::config::host,
|
|
|
|
'port' => $::openstack_integration::config::rabbit_port,
|
|
|
|
'username' => 'neutron',
|
|
|
|
'password' => 'an_even_bigger_secret',
|
|
|
|
}),
|
2016-03-01 13:38:07 -05:00
|
|
|
rabbit_use_ssl => $::openstack_integration::config::ssl,
|
2015-12-23 22:54:56 +01:00
|
|
|
allow_overlapping_ips => true,
|
|
|
|
core_plugin => 'ml2',
|
2016-09-26 14:15:22 +00:00
|
|
|
service_plugins => ['router', 'metering', 'firewall', 'lbaasv2'],
|
2015-12-23 22:54:56 +01:00
|
|
|
debug => true,
|
2016-03-02 19:09:05 -05:00
|
|
|
bind_host => $::openstack_integration::config::host,
|
2016-05-10 15:21:48 -04:00
|
|
|
use_ssl => $::openstack_integration::config::ssl,
|
|
|
|
cert_file => $::openstack_integration::params::cert_path,
|
|
|
|
key_file => "/etc/neutron/ssl/private/${::fqdn}.pem",
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
|
|
|
class { '::neutron::client': }
|
2016-08-30 14:56:51 -04:00
|
|
|
class { '::neutron::keystone::authtoken':
|
|
|
|
password => 'a_big_secret',
|
|
|
|
user_domain_name => 'Default',
|
|
|
|
project_domain_name => 'Default',
|
|
|
|
auth_url => $::openstack_integration::config::keystone_admin_uri,
|
|
|
|
auth_uri => $::openstack_integration::config::keystone_auth_uri,
|
|
|
|
memcached_servers => $::openstack_integration::config::memcached_servers,
|
|
|
|
}
|
2015-12-23 22:54:56 +01:00
|
|
|
class { '::neutron::server':
|
2016-01-08 13:26:10 -05:00
|
|
|
database_connection => 'mysql+pymysql://neutron:neutron@127.0.0.1/neutron?charset=utf8',
|
2015-12-23 22:54:56 +01:00
|
|
|
sync_db => true,
|
2016-02-24 12:36:11 -05:00
|
|
|
api_workers => 2,
|
|
|
|
rpc_workers => 2,
|
2016-05-24 22:30:55 -04:00
|
|
|
service_providers => ['LOADBALANCER:Haproxy:neutron_lbaas.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default',
|
2016-11-22 13:54:28 -05:00
|
|
|
'LOADBALANCERV2:Haproxy:neutron_lbaas.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default',
|
|
|
|
'FIREWALL:Iptables:neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver:default'],
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
2016-05-24 22:30:55 -04:00
|
|
|
class { '::neutron::services::lbaas': }
|
2015-12-23 22:54:56 +01:00
|
|
|
class { '::neutron::plugins::ml2':
|
2017-03-22 15:41:02 +08:00
|
|
|
type_drivers => ['vxlan', 'vlan', 'flat'],
|
|
|
|
tenant_network_types => ['vxlan', 'vlan', 'flat'],
|
2017-03-17 10:03:17 +08:00
|
|
|
extension_drivers => 'port_security',
|
2016-03-22 19:22:13 -04:00
|
|
|
mechanism_drivers => $driver,
|
2016-04-01 17:55:01 +03:00
|
|
|
firewall_driver => $firewall_driver,
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
2017-02-03 11:02:03 -05:00
|
|
|
if $::openstack_integration::config::ssl {
|
|
|
|
$metadata_protocol = 'https'
|
|
|
|
$nova_client_cert = $::openstack_integration::params::cert_path
|
|
|
|
$nova_client_priv_key = "/etc/neutron/ssl/private/${::fqdn}.pem"
|
|
|
|
} else {
|
|
|
|
$metadata_protocol = $::os_service_default
|
|
|
|
$nova_client_cert = $::os_service_default
|
|
|
|
$nova_client_priv_key = $::os_service_default
|
|
|
|
}
|
2015-12-23 22:54:56 +01:00
|
|
|
class { '::neutron::agents::metadata':
|
2017-02-03 11:02:03 -05:00
|
|
|
debug => true,
|
|
|
|
shared_secret => 'a_big_secret',
|
|
|
|
metadata_workers => 2,
|
|
|
|
metadata_protocol => $metadata_protocol,
|
|
|
|
metadata_insecure => true,
|
|
|
|
nova_client_cert => $nova_client_cert,
|
|
|
|
nova_client_priv_key => $nova_client_priv_key,
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
|
|
|
class { '::neutron::agents::lbaas':
|
2016-03-22 19:22:13 -04:00
|
|
|
interface_driver => $driver,
|
|
|
|
debug => true,
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
|
|
|
class { '::neutron::agents::l3':
|
2017-01-21 19:55:28 +08:00
|
|
|
interface_driver => $driver,
|
|
|
|
debug => true,
|
|
|
|
extensions => 'fwaas',
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
|
|
|
class { '::neutron::agents::dhcp':
|
2016-03-22 19:22:13 -04:00
|
|
|
interface_driver => $driver,
|
|
|
|
debug => true,
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
|
|
|
class { '::neutron::agents::metering':
|
2016-03-22 19:22:13 -04:00
|
|
|
interface_driver => $driver,
|
|
|
|
debug => true,
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
|
|
|
class { '::neutron::server::notifications':
|
2016-03-01 18:50:40 -05:00
|
|
|
auth_url => $::openstack_integration::config::keystone_admin_uri,
|
2016-01-06 17:39:07 -05:00
|
|
|
password => 'a_big_secret',
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
2016-02-23 22:40:49 -05:00
|
|
|
class { '::neutron::services::fwaas':
|
2016-11-22 13:54:28 -05:00
|
|
|
enabled => true,
|
|
|
|
agent_version => 'v1',
|
|
|
|
driver => 'neutron_fwaas.services.firewall.drivers.linux.iptables_fwaas.IptablesFwaasDriver',
|
|
|
|
|
2016-02-23 22:40:49 -05:00
|
|
|
}
|
2015-12-23 22:54:56 +01:00
|
|
|
|
|
|
|
}
|