Skip to content

Instantly share code, notes, and snippets.

@imcsk8
Created April 1, 2016 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imcsk8/9fed07d3417eb55790355b3a87301f8e to your computer and use it in GitHub Desktop.
Save imcsk8/9fed07d3417eb55790355b3a87301f8e to your computer and use it in GitHub Desktop.
$use_subnets_value = hiera('CONFIG_USE_SUBNETS')
$use_subnets = $use_subnets_value ? {
'y' => true,
default => false,
}
Exec { timeout => hiera('DEFAULT_EXEC_TIMEOUT') }
$neutron_db_host = hiera('CONFIG_MARIADB_HOST_URL')
$neutron_db_name = hiera('CONFIG_NEUTRON_L2_DBNAME')
$neutron_db_user = 'neutron'
$neutron_db_password = hiera('CONFIG_NEUTRON_DB_PW')
$neutron_sql_connection = "mysql+pymysql://${neutron_db_user}:${neutron_db_password}@${neutron_db_host}/${neutron_db_name}"
$neutron_user_password = hiera('CONFIG_NEUTRON_KS_PW')
$bind_host = hiera('CONFIG_IP_VERSION') ? {
'ipv6' => '::0',
default => '0.0.0.0',
# TO-DO(mmagr): Add IPv6 support when hostnames are used
}
$kombu_ssl_ca_certs = hiera('CONFIG_AMQP_SSL_CACERT_FILE', undef)
$kombu_ssl_keyfile = hiera('CONFIG_NEUTRON_SSL_KEY', undef)
$kombu_ssl_certfile = hiera('CONFIG_NEUTRON_SSL_CERT', undef)
if $kombu_ssl_keyfile {
$files_to_set_owner = [ $kombu_ssl_keyfile, $kombu_ssl_certfile ]
file { $files_to_set_owner:
owner => 'neutron',
group => 'neutron',
require => Class['neutron'],
}
File[$files_to_set_owner] ~> Service<||>
}
class { '::neutron':
bind_host => $bind_host,
rabbit_host => hiera('CONFIG_AMQP_HOST_URL'),
rabbit_port => hiera('CONFIG_AMQP_CLIENTS_PORT'),
rabbit_use_ssl => hiera('CONFIG_AMQP_SSL_ENABLED'),
rabbit_user => hiera('CONFIG_AMQP_AUTH_USER'),
rabbit_password => hiera('CONFIG_AMQP_AUTH_PASSWORD'),
core_plugin => hiera('CONFIG_NEUTRON_CORE_PLUGIN'),
allow_overlapping_ips => true,
service_plugins => hiera_array('SERVICE_PLUGINS'),
verbose => true,
debug => hiera('CONFIG_DEBUG_MODE'),
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_certfile => $kombu_ssl_certfile,
}
class { '::neutron::server':
database_connection => $neutron_sql_connection,
auth_password => $neutron_user_password,
auth_uri => hiera('CONFIG_KEYSTONE_PUBLIC_URL'),
identity_uri => hiera('CONFIG_KEYSTONE_ADMIN_URL'),
sync_db => true,
enabled => true,
}
# TODO: FIXME: remove this hack after upstream resolves https://bugs.launchpad.net/puppet-neutron/+bug/1474961
if hiera('CONFIG_NEUTRON_VPNAAS') == 'y' {
ensure_resource( 'package', 'neutron-vpnaas-agent', {
name => 'openstack-neutron-vpnaas',
tag => ['openstack', 'neutron-package'],
})
Package['neutron-vpnaas-agent'] ~> Service<| tag == 'neutron-service' |>
}
if hiera('CONFIG_NEUTRON_FWAAS') == 'y' {
ensure_resource( 'package', 'neutron-fwaas', {
'name' => 'openstack-neutron-fwaas',
'tag' => 'openstack'
})
Package['neutron-fwaas'] ~> Service<| tag == 'neutron-service' |>
}
if hiera('CONFIG_LBAAS_INSTALL') == 'y' {
ensure_resource( 'package', 'neutron-lbaas-agent', {
name => 'openstack-neutron-lbaas',
tag => ['openstack', 'neutron-package'],
})
Package['neutron-lbaas-agent'] ~> Service<| tag == 'neutron-service' |>
}
file { '/etc/neutron/api-paste.ini':
ensure => file,
mode => '0640',
}
Class['::neutron::server'] -> File['/etc/neutron/api-paste.ini']
$neutron_notif_cfg_ctrl_host = hiera('CONFIG_KEYSTONE_HOST_URL')
# Configure nova notifications system
class { '::neutron::server::notifications':
nova_admin_username => 'nova',
nova_admin_password => hiera('CONFIG_NOVA_KS_PW'),
nova_admin_tenant_name => 'services',
nova_url => "http://${neutron_notif_cfg_ctrl_host}:8774/v2",
nova_admin_auth_url => hiera('CONFIG_KEYSTONE_PUBLIC_URL'),
nova_region_name => hiera('CONFIG_KEYSTONE_REGION'),
}
if hiera('CONFIG_NEUTRON_ML2_VXLAN_GROUP') == '' {
$vxlan_group_value = undef
} else {
$vxlan_group_value = hiera('CONFIG_NEUTRON_ML2_VXLAN_GROUP')
}
class { '::neutron::plugins::ml2':
type_drivers => hiera_array('CONFIG_NEUTRON_ML2_TYPE_DRIVERS'),
tenant_network_types => hiera_array('CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES'),
mechanism_drivers => hiera_array('CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS'),
flat_networks => hiera_array('CONFIG_NEUTRON_ML2_FLAT_NETWORKS'),
network_vlan_ranges => hiera_array('CONFIG_NEUTRON_ML2_VLAN_RANGES'),
tunnel_id_ranges => hiera_array('CONFIG_NEUTRON_ML2_TUNNEL_ID_RANGES'),
vxlan_group => $vxlan_group_value,
vni_ranges => hiera_array('CONFIG_NEUTRON_ML2_VNI_RANGES'),
vni_ranges => hiera_array('CONFIG_NEUTRON_ML2_VNI_RANGES'),
enable_security_group => true,
supported_pci_vendor_devs => hiera_array('CONFIG_NEUTRON_ML2_SUPPORTED_PCI_VENDOR_DEVS'),
sriov_agent_required => hiera('CONFIG_NEUTRON_ML2_SRIOV_AGENT_REQUIRED'),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment