2013-08-05 13:20:54 -04:00
# = = Class : neutron: : server
2013-05-06 14:15:29 -06:00
#
2013-08-05 13:20:54 -04:00
# Setup and configure the neutron API endpoint
2013-05-06 14:15:29 -06:00
#
# = = = Parameters
#
# [ * package_ensure* ]
# ( optional) The state of the package
# Defaults to present
#
# [ * enabled* ]
# ( optional) The state of the service
# Defaults to true
#
2014-01-15 22:52:03 -06:00
# [ * manage_service* ]
# ( optional) Whether to start/ stop the service
# Defaults to true
#
2014-11-21 09:57:46 -07:00
# [ * service_name* ]
# ( optional) The name of the neutron- server service
2016-01-05 12:30:00 -07:00
# Defaults to $ : : neutron: : params: : server_service
2014-11-21 09:57:46 -07:00
#
2013-05-06 14:15:29 -06:00
# [ * log_file* ]
2014-02-25 18:43:55 +01:00
# REMOVED: Use log_file of neutron class instead.
2013-05-21 15:36:16 -05:00
#
# [ * log_dir* ]
2014-02-25 18:43:55 +01:00
# REMOVED: Use log_dir of neutron class instead.
2013-05-06 14:15:29 -06:00
#
# [ * auth_type* ]
# ( optional) What auth system to use
# Defaults to 'keystone' . Can other be 'noauth'
#
2016-01-20 12:41:20 +03:00
# [ * auth_plugin* ]
# ( optional) An authentication plugin to use with an OpenStack Identity server.
2015-11-02 19:25:12 +03:00
# Defaults to $ : : os_service_default
2015-07-02 16:12:46 -05:00
#
2013-08-29 09:52:51 -04:00
# [ * auth_uri* ]
# ( optional) Complete public Identity API endpoint.
2015-12-24 14:04:57 +03:00
# Defaults to : 'http://localhost:5000/'
2015-01-16 14:06:21 -05:00
#
2016-01-20 12:41:20 +03:00
# [ * auth_url* ]
# ( optional) Authorization URL.
# If version independent identity plugin is used available versions will be
# determined using auth_url
# Defaults to 'http://localhost:35357'
#
# [ * username* ]
# ( optional) The name of the auth user
# Defaults to 'neutron'
#
# [ * password* ]
# The password to use for authentication ( keystone)
# Either password or auth_password is required
#
# [ * tenant_name* ]
# ( optional) The tenant of the auth user
# Defaults to 'services'
#
# [ * project_domain_id* ]
# ( optional) Auth user project' s domain ID
# Defaults to $ : : os_service_default
#
# [ * project_name* ]
# ( optional) Auth user project' s name
# Defaults to $ : : os_service_default
#
# [ * user_domain_id* ]
# ( optional) Auth user' s domain ID
# Defaults to $ : : os_service_default
#
# [ * region_name* ]
# ( optional) The authentication region
# Defaults to $ : : os_service_default
2013-08-29 09:52:51 -04:00
#
2014-01-28 13:23:13 -05:00
# [ * database_connection* ]
2013-10-31 17:33:36 +00:00
# ( optional) Connection url for the neutron database.
2015-08-03 12:47:08 +02:00
# ( Defaults to undef)
2014-01-28 13:23:13 -05:00
#
# [ * sql_connection* ]
# DEPRECATED : Use database_connection instead.
#
# [ * connection* ]
# DEPRECATED : Use database_connection instead.
#
# [ * database_max_retries* ]
# ( optional) Maximum database connection retries during startup.
2015-08-03 12:47:08 +02:00
# ( Defaults to undef)
2014-01-28 13:23:13 -05:00
#
# [ * sql_max_retries* ]
# DEPRECATED : Use database_max_retries instead.
2013-10-31 17:33:36 +00:00
#
# [ * max_retries* ]
2014-01-28 13:23:13 -05:00
# DEPRECATED : Use database_max_retries instead.
2013-10-31 17:33:36 +00:00
#
2014-01-28 13:23:13 -05:00
# [ * database_idle_timeout* ]
# ( optional) Timeout before idle database connections are reaped.
2013-10-31 17:33:36 +00:00
# Deprecates sql_idle_timeout
2015-08-03 12:47:08 +02:00
# ( Defaults to undef)
2014-01-28 13:23:13 -05:00
#
# [ * sql_idle_timeout* ]
# DEPRECATED : Use database_idle_timeout instead.
#
# [ * idle_timeout* ]
# DEPRECATED : Use database_idle_timeout instead.
#
# [ * database_retry_interval* ]
# ( optional) Interval between retries of opening a database connection.
# ( Defaults to 1 0 )
#
# [ * sql_reconnect_interval* ]
# DEPRECATED : Use database_retry_interval instead.
2013-10-31 17:33:36 +00:00
#
# [ * retry_interval* ]
2014-01-28 13:23:13 -05:00
# DEPRECATED : Use database_retry_interval instead.
2013-10-31 17:33:36 +00:00
#
2014-09-25 12:47:25 +02:00
# [ * database_min_pool_size* ]
# ( optional) Minimum number of SQL connections to keep open in a pool.
2015-08-03 12:47:08 +02:00
# Defaults to : undef.
2014-09-25 12:47:25 +02:00
#
# [ * database_max_pool_size* ]
# ( optional) Maximum number of SQL connections to keep open in a pool.
2015-08-03 12:47:08 +02:00
# Defaults to : undef.
2014-09-25 12:47:25 +02:00
#
# [ * database_max_overflow* ]
# ( optional) If set , use this value for max_overflow with sqlalchemy.
2015-08-03 12:47:08 +02:00
# Defaults to : undef.
2014-09-25 12:47:25 +02:00
#
2014-02-03 13:28:03 +01:00
# [ * sync_db* ]
# ( optional) Run neutron- db- manage on api nodes after installing the package .
2014-03-06 15:39:50 -05:00
# Defaults to false
2014-02-03 13:28:03 +01:00
#
2013-11-30 16:16:17 +01:00
# [ * api_workers* ]
# ( optional) Number of separate worker processes to spawn.
2014-09-12 16:23:52 +02:00
# The default , count of machine' s processors, runs the worker thread in the
# current process.
2013-11-30 16:16:17 +01:00
# Greater than 0 launches that number of child processes as workers.
# The parent process manages them.
2014-09-12 16:23:52 +02:00
# Defaults to : $ : : processorcount
2013-11-30 16:16:17 +01:00
#
2014-07-10 10:37:30 -07:00
# [ * rpc_workers* ]
# ( optional) Number of separate RPC worker processes to spawn.
2014-09-12 16:23:52 +02:00
# The default , count of machine' s processors, runs the worker thread in the
# current process.
2014-07-10 10:37:30 -07:00
# Greater than 0 launches that number of child processes as workers.
# The parent process manages them.
2014-09-12 16:23:52 +02:00
# Defaults to : $ : : processorcount
2014-07-10 10:37:30 -07:00
#
2013-12-24 20:13:55 +01:00
# [ * agent_down_time* ]
# ( optional) Seconds to regard the agent as down; should be at least twice
# report_interval, to be sure the agent is down for good.
2014-04-09 16:37:20 +02:00
# agent_down_time is a config for neutron- server, set by class neutron: : server
# report_interval is a config for neutron agents, set by class neutron
2015-12-04 13:01:44 +03:00
# Defaults to : $ : : os_service_default
2013-12-24 20:13:55 +01:00
#
2014-11-21 14:15:41 +01:00
# [ * state_path* ]
2014-12-20 16:36:34 -07:00
# ( optional) Deprecated . Use state_path parameter on base neutron class instead.
2014-11-21 14:15:41 +01:00
#
# [ * lock_path* ]
2014-12-20 16:36:34 -07:00
# ( optional) Deprecated . Use lock_path parameter on base neutron class instead.
2014-11-21 14:15:41 +01:00
#
2013-12-25 00:46:23 +01:00
# [ * router_scheduler_driver* ]
# ( optional) Driver to use for scheduling router to a default L3 agent. Could be:
# neutron. scheduler. l3_agent_scheduler. ChanceScheduler to schedule a router in a random way
# neutron. scheduler. l3_agent_scheduler. LeastRoutersScheduler to allocate on an L3 agent with the least number of routers bound.
# Defaults to : neutron. scheduler. l3_agent_scheduler. ChanceScheduler
#
2014-09-18 14:21:03 -04:00
# [ * router_distributed* ]
# ( optional) Setting the "router_distributed" flag to "True" will default to the creation
# of distributed tenant routers.
# Also can be the type of the router on the create request ( admin- only attribute) .
2015-12-04 13:01:44 +03:00
# Defaults to $ : : os_service_default
2014-09-18 14:21:03 -04:00
#
2015-02-24 13:03:10 -07:00
# [ * allow_automatic_l3agent_failover* ]
# ( optional) Allow automatic rescheduling of routers from dead L3 agents with
# admin_state_up set to True to alive agents.
2015-12-04 13:01:44 +03:00
# Defaults to $ : : os_service_default
2015-02-24 13:03:10 -07:00
#
2014-09-18 14:21:03 -04:00
# [ * l3_ha* ]
# ( optional) Enable high availability for virtual routers.
# Defaults to false
#
# [ * max_l3_agents_per_router* ]
# ( optional) Maximum number of l3 agents which a HA router will be scheduled on. If set to '0' , a router will be scheduled on every agent.
# Defaults to '3'
#
# [ * min_l3_agents_per_router* ]
# ( optional) Minimum number of l3 agents which a HA router will be scheduled on.
# Defaults to '2'
#
# [ * l3_ha_net_cidr* ]
# ( optional) CIDR of the administrative network if HA mode is enabled.
2015-12-04 13:01:44 +03:00
# Defaults to $ : : os_service_default
2014-09-18 14:21:03 -04:00
#
2015-08-06 19:38:33 +02:00
# [ * report_interval* ]
# ( optional) Deprecated , does nothing.
# Defaults to 'undef' .
#
2015-08-25 13:29:04 +03:00
# [ * qos_notification_drivers* ]
# ( optional) Drivers list to use to send the update notification
# Defaults to $ : : os_service_default.
#
2016-01-20 12:41:20 +03:00
# = = = Deprecated Parameters
#
# [ * identity_uri* ]
# Deprecated . Auth plugins based authentication should be used instead
# ( optional) Complete admin Identity API endpoint.
# Defaults to : 'http://localhost:35357/'
#
# [ * auth_region* ]
# Deprecated . Auth plugins based authentication should be used instead
# ( optional) The authentication region. Note this value is case - sensitive and
# must match the endpoint region defined in Keystone.
# Defaults to $ : : os_service_default
#
# [ * auth_tenant* ]
# Deprecated . Auth plugins based authentication should be used instead
# ( optional) The tenant of the auth user
# Defaults to services
#
# [ * auth_user* ]
# Deprecated . Auth plugins based authentication should be used instead
# ( optional) The name of the auth user
# Defaults to neutron
#
# [ * auth_password* ]
# Deprecated . Auth plugins based authentication should be used instead
# ( optional) The password to use for authentication ( keystone)
# Defaults to false . Set a value unless you are using noauth
#
2013-08-05 13:20:54 -04:00
class neutron: : server (
2015-02-24 13:03:10 -07:00
$ package_ensure = 'present' ,
$e nabled = true ,
$ manage_service = true ,
$ service_name = $ : : neutron: : params: : server_service,
$a uth_type = 'keystone' ,
2016-01-20 12:41:20 +03:00
$a uth_plugin = $ : : os_service_default,
2015-12-24 14:04:57 +03:00
$a uth_uri = 'http://localhost:5000/' ,
2016-01-20 12:41:20 +03:00
$a uth_url = 'http://localhost:35357/' ,
$ username = 'neutron' ,
$ password = false ,
$ tenant_name = 'services' ,
$ region_name = $ : : os_service_default,
$ project_domain_id = $ : : os_service_default,
$ project_name = $ : : os_service_default,
$ user_domain_id = $ : : os_service_default,
2015-08-03 12:47:08 +02:00
$da tabase_connection = undef,
$da tabase_max_retries = undef,
$da tabase_idle_timeout = undef,
$da tabase_retry_interval = undef,
$da tabase_min_pool_size = undef,
$da tabase_max_pool_size = undef,
$da tabase_max_overflow = undef,
2015-02-24 13:03:10 -07:00
$ sync_db = false ,
$a pi_workers = $ : : processorcount,
$ rpc_workers = $ : : processorcount,
2015-12-04 13:01:44 +03:00
$a gent_down_time = $ : : os_service_default,
2015-02-24 13:03:10 -07:00
$ router_scheduler_driver = 'neutron.scheduler.l3_agent_scheduler.ChanceScheduler' ,
2015-12-04 13:01:44 +03:00
$ router_distributed = $ : : os_service_default,
$a llow_automatic_l3agent_failover = $ : : os_service_default,
2015-02-24 13:03:10 -07:00
$ l3_ha = false ,
$ max_l3_agents_per_router = 3 ,
$ min_l3_agents_per_router = 2 ,
2015-12-04 13:01:44 +03:00
$ l3_ha_net_cidr = $ : : os_service_default,
2015-08-25 13:29:04 +03:00
$ qos_notification_drivers = $ : : os_service_default,
2014-01-28 13:23:13 -05:00
# DEPRECATED PARAMETERS
2015-02-24 13:03:10 -07:00
$ log_dir = undef,
$ log_file = undef,
$ report_interval = undef,
$ state_path = undef,
$ lock_path = undef,
2016-01-20 12:41:20 +03:00
$a uth_password = false ,
$a uth_region = $ : : os_service_default,
$a uth_tenant = 'services' ,
$a uth_user = 'neutron' ,
$ identity_uri = 'http://localhost:35357/' ,
2016-01-05 12:30:00 -07:00
) inherits : : neutron: : params {
2012-10-21 00:34:24 +02:00
2015-08-03 12:47:08 +02:00
include : : neutron: : db
2015-02-17 09:01:27 -05:00
include : : neutron: : policy
2012-10-09 10:21:36 +02:00
2013-08-05 13:20:54 -04:00
Neutron_config< | | > ~ > Service[ 'neutron-server' ]
Neutron_api_config< | | > ~ > Service[ 'neutron-server' ]
2014-10-22 11:31:47 -04:00
Class [ 'neutron::policy' ] ~ > Service[ 'neutron-server' ]
2015-08-28 17:21:41 -04:00
Neutron_config< | | > - > Neutron_network< | | >
2012-10-09 10:21:36 +02:00
2014-09-18 14:21:03 -04:00
if $ l3_ha {
2015-06-09 12:20:49 -07:00
if $ min_l3_agents_per_router < = $ max_l3_agents_per_router or $ max_l3_agents_per_router = = 0 {
2014-09-18 14:21:03 -04:00
neutron_config {
2014-12-10 15:54:23 +01:00
'DEFAULT/l3_ha' : value = > true ;
2014-09-18 14:21:03 -04:00
'DEFAULT/max_l3_agents_per_router' : value = > $ max_l3_agents_per_router;
'DEFAULT/min_l3_agents_per_router' : value = > $ min_l3_agents_per_router;
'DEFAULT/l3_ha_net_cidr' : value = > $ l3_ha_net_cidr;
}
} else {
fail( 'min_l3_agents_per_router should be less than or equal to max_l3_agents_per_router.' )
}
2015-03-12 18:31:10 -06:00
} else {
neutron_config {
'DEFAULT/l3_ha' : value = > false ;
}
2014-09-18 14:21:03 -04:00
}
2013-10-31 17:33:36 +00:00
2014-02-03 13:28:03 +01:00
if $ sync_db {
2015-06-29 15:46:13 +02:00
include : : neutron: : db: : sync
2014-02-03 13:28:03 +01:00
}
2013-10-31 17:33:36 +00:00
neutron_config {
2015-02-24 13:03:10 -07:00
'DEFAULT/api_workers' : value = > $a pi_workers;
'DEFAULT/rpc_workers' : value = > $ rpc_workers;
'DEFAULT/agent_down_time' : value = > $a gent_down_time;
'DEFAULT/router_scheduler_driver' : value = > $ router_scheduler_driver;
'DEFAULT/router_distributed' : value = > $ router_distributed;
'DEFAULT/allow_automatic_l3agent_failover' : value = > $a llow_automatic_l3agent_failover;
2013-10-31 17:33:36 +00:00
}
2014-12-20 16:36:34 -07:00
if $ state_path {
# If we got state_path here, display deprecation warning and override the value from
# the base class . This preserves the behavior of before state_path was deprecated .
warning( 'The state_path parameter is deprecated. Use the state_path parameter on the base neutron class instead.' )
Neutron_config < | title = = 'DEFAULT/state_path' | > {
value = > $ state_path,
}
}
if $ lock_path {
# If we got lock_path here, display deprecation warning and override the value from
# the base class . This preserves the behavior of before lock_path was deprecated .
warning( 'The lock_path parameter is deprecated. Use the lock_path parameter on the base neutron class instead.' )
Neutron_config < | title = = 'DEFAULT/lock_path' | > {
value = > $ lock_path,
}
}
2015-08-25 13:29:04 +03:00
neutron_config { 'qos/notification_drivers': value => join(any2array($qos_notification_drivers), ',') }
2013-08-05 13:20:54 -04:00
if ( $ : : neutron: : params: : server_package) {
Package [ 'neutron-server' ] - > Neutron_api_config< | | >
Package [ 'neutron-server' ] - > Neutron_config< | | >
Package [ 'neutron-server' ] - > Service[ 'neutron-server' ]
2014-10-22 11:31:47 -04:00
Package [ 'neutron-server' ] - > Class [ 'neutron::policy' ]
2013-08-05 13:20:54 -04:00
package { 'neutron-server' :
2013-08-09 16:35:19 +00:00
ensure = > $ package_ensure,
2013-08-05 13:20:54 -04:00
name = > $ : : neutron: : params: : server_package,
2015-07-22 23:08:04 +02:00
tag = > [ 'openstack' , 'neutron-package' ] ,
2013-04-19 11:08:22 -07:00
}
2013-05-19 00:42:56 -04:00
} else {
2013-08-05 13:20:54 -04:00
# Some platforms ( RedHat) does not provide a neutron- server package .
# The neutron api config file is provided by the neutron package .
2014-10-22 11:31:47 -04:00
Package [ 'neutron' ] - > Class [ 'neutron::policy' ]
2013-08-05 13:20:54 -04:00
Package [ 'neutron' ] - > Neutron_api_config< | | >
2012-10-09 10:21:36 +02:00
}
2016-01-20 12:41:20 +03:00
neutron_config {
'DEFAULT/auth_type' : value = > $a uth_type;
}
2013-05-06 14:15:29 -06:00
if ( $a uth_type = = 'keystone' ) {
2016-01-20 12:41:20 +03:00
if ( $a uth_password = = false ) and ( $ password = = false ) {
fail( 'Either auth_password or password must be set when using keystone authentication.' )
} elsif ( $a uth_password ! = false ) and ( $ password ! = false ) {
fail( 'auth_password and password must not be used together.' )
2013-05-06 14:15:29 -06:00
} else {
2016-01-20 12:41:20 +03:00
neutron_config {
'keystone_authtoken/auth_uri' : value = > $a uth_uri;
}
neutron_api_config {
'filter:authtoken/auth_uri' : value = > $a uth_uri;
}
}
2015-01-16 14:06:21 -05:00
2016-01-20 12:41:20 +03:00
if $a uth_password {
warning( 'identity_uri, auth_tenant, auth_user, auth_password, auth_region configuration options are deprecated in favor of auth_plugin and related options' )
2013-08-05 13:20:54 -04:00
neutron_config {
2013-05-10 00:07:46 -04:00
'keystone_authtoken/admin_tenant_name' : value = > $a uth_tenant;
2013-05-06 14:15:29 -06:00
'keystone_authtoken/admin_user' : value = > $a uth_user;
2014-07-12 02:28:55 +02:00
'keystone_authtoken/admin_password' : value = > $a uth_password, secret = > true ;
2016-01-20 12:41:20 +03:00
'keystone_authtoken/auth_region' : value = > $a uth_region;
'keystone_authtoken/identity_uri' : value = > $ identity_uri;
2013-05-06 14:15:29 -06:00
}
2013-08-05 13:20:54 -04:00
neutron_api_config {
2013-05-06 14:15:29 -06:00
'filter:authtoken/admin_tenant_name' : value = > $a uth_tenant;
'filter:authtoken/admin_user' : value = > $a uth_user;
2014-07-12 02:28:55 +02:00
'filter:authtoken/admin_password' : value = > $a uth_password, secret = > true ;
2016-01-20 12:41:20 +03:00
'filter:authtoken/identity_uri' : value = > $ identity_uri;
2013-05-06 14:15:29 -06:00
}
2013-05-15 09:14:19 +02:00
2016-01-20 12:41:20 +03:00
} else {
2015-01-16 14:06:21 -05:00
2015-11-02 19:25:12 +03:00
neutron_config {
2016-01-20 12:41:20 +03:00
'keystone_authtoken/auth_url' : value = > $a uth_url;
'keystone_authtoken/auth_plugin' : value = > $a uth_plugin;
'keystone_authtoken/tenant_name' : value = > $ tenant_name;
'keystone_authtoken/username' : value = > $ username;
'keystone_authtoken/password' : value = > $ password, secret = > true ;
'keystone_authtoken/region_name' : value = > $ region_name;
'keystone_authtoken/project_domain_id' : value = > $ project_domain_id;
'keystone_authtoken/project_name' : value = > $ project_name;
'keystone_authtoken/user_domain_id' : value = > $ user_domain_id;
2015-07-02 16:12:46 -05:00
2016-01-20 12:41:20 +03:00
}
2013-05-06 14:15:29 -06:00
}
2013-05-15 09:14:19 +02:00
2013-05-06 14:15:29 -06:00
}
2014-01-15 22:52:03 -06:00
if $ manage_service {
if $e nabled {
$ service_ensure = 'running'
} else {
$ service_ensure = 'stopped'
}
}
2013-08-05 13:20:54 -04:00
service { 'neutron-server' :
2012-10-09 10:21:36 +02:00
ensure = > $ service_ensure,
2014-11-21 09:57:46 -07:00
name = > $ service_name,
2012-10-09 10:21:36 +02:00
enable = > $e nabled,
hasstatus = > true ,
2013-05-19 00:42:56 -04:00
hasrestart = > true ,
2013-08-05 13:20:54 -04:00
require = > Class [ 'neutron' ] ,
2015-10-05 20:15:04 +00:00
tag = > [ 'neutron-service' , 'neutron-db-sync-service' ] ,
2012-10-09 10:21:36 +02:00
}
}