Files
puppet-neutron/manifests/services/vpnaas.pp
Takashi Kajinami b3a382f738 Validate ensure parameter for package resources
The minimum version of puppetlabs-stdlib has been bumped globally, so
now we can use the common type definition.

Change-Id: Ide3c9d927c25721001295faa105835928a95cf9d
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
2025-09-23 21:27:01 +09:00

81 lines
2.8 KiB
Puppet

# This class installs and configures vpnaas Neutron Plugin.
#
# === Parameters
#
# [*package_ensure*]
# (optional) Ensure state for package.
# Defaults to 'present'.
#
# [*service_providers*]
# (optional) Array of allowed service types includes vpnaas
# Must be in form: <service_type>:<name>:<driver>[:default]
# Defaults to 'VPN:openswan:neutron_vpnaas.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default'.
#
# [*vpn_scheduler_driver*]
# (optional) Driver to use for scheduling router to a VPN agent.
# Defaults to $facts['os_service_default']
#
# [*vpn_auto_schedule*]
# (optional) Allow auto scheduling of routers to VPN agent.
# Defaults to $facts['os_service_default']
#
# [*allow_automatic_vpnagent_failover*]
# (optional) Automatically reschedule routers from offline VPN agents to
# online VPN agents.
# Defaults to $facts['os_service_default']
#
# [*sync_db*]
# (optional) Whether 'neutron-db-manage' should run to create and/or
# synchronize the database with neutron-vpnaas specific tables.
# Default to false.
#
# [*purge_config*]
# (optional) Whether to set only the specified config options
# in the vpnaas config.
# Defaults to false.
#
class neutron::services::vpnaas (
Stdlib::Ensure::Package $package_ensure = 'present',
$service_providers = 'VPN:openswan:neutron_vpnaas.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default',
$vpn_scheduler_driver = $facts['os_service_default'],
$vpn_auto_schedule = $facts['os_service_default'],
$allow_automatic_vpnagent_failover = $facts['os_service_default'],
Boolean $sync_db = false,
Boolean $purge_config = false,
) {
include neutron::deps
include neutron::params
stdlib::ensure_packages( 'neutron-vpnaas-agent', {
'ensure' => $package_ensure,
'name' => $neutron::params::vpnaas_agent_package,
'tag' => ['openstack', 'neutron-package'],
})
resources { 'neutron_vpnaas_service_config':
purge => $purge_config,
}
neutron_vpnaas_service_config {
'service_providers/service_provider': value => $service_providers;
'DEFAULT/vpn_scheduler_driver': value => $vpn_scheduler_driver;
'DEFAULT/vpn_auto_schedule': value => $vpn_auto_schedule;
'DEFAULT/allow_automatic_vpnagent_failover': value => $allow_automatic_vpnagent_failover;
}
if $sync_db {
exec { 'vpnaas-db-sync':
command => 'neutron-db-manage --subproject neutron-vpnaas upgrade head',
path => '/usr/bin',
user => $neutron::params::user,
subscribe => [
Anchor['neutron::install::end'],
Anchor['neutron::config::end'],
Anchor['neutron::dbsync::begin']
],
notify => Anchor['neutron::dbsync::end'],
refreshonly => true,
}
}
}