2 # Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
4 # Author: Emilien Macchi <emilien.macchi@enovance.com>
6 # Licensed under the Apache License, Version 2.0 (the "License"); you may
7 # not use this file except in compliance with the License. You may obtain
8 # a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 # License for the specific language governing permissions and limitations
18 # == Class: neutron::agents:vpnaas
20 # Setups Neutron VPN agent.
25 # (optional) Ensure state for package. Defaults to 'present'.
28 # (optional) Enable state for service. Defaults to 'true'.
31 # (optional) Whether to start/stop the service
34 # [*vpn_device_driver*]
35 # (optional) Defaults to 'neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver'.
37 # [*interface_driver*]
38 # (optional) Defaults to 'neutron.agent.linux.interface.OVSInterfaceDriver'.
40 # [*external_network_bridge]
41 # (optional) Defaults to undef
43 # [*ipsec_status_check_interval*]
44 # (optional) Status check interval. Defaults to '60'.
46 class neutron::agents::vpnaas (
47 $package_ensure = present,
49 $manage_service = true,
50 $vpn_device_driver = 'neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver',
51 $interface_driver = 'neutron.agent.linux.interface.OVSInterfaceDriver',
52 $external_network_bridge = undef,
53 $ipsec_status_check_interval = '60'
56 include neutron::params
58 Neutron_config<||> ~> Service['neutron-vpnaas-service']
59 Neutron_vpnaas_agent_config<||> ~> Service['neutron-vpnaas-service']
61 case $vpn_device_driver {
63 Package['openswan'] -> Package<| title == 'neutron-vpnaas-agent' |>
66 name => $::neutron::params::openswan_package,
70 fail("Unsupported vpn_device_driver ${vpn_device_driver}")
74 # The VPNaaS agent loads both neutron.ini and its own file.
75 # This only lists config specific to the agent. neutron.ini supplies
77 neutron_vpnaas_agent_config {
78 'vpnagent/vpn_device_driver': value => $vpn_device_driver;
79 'ipsec/ipsec_status_check_interval': value => $ipsec_status_check_interval;
80 'DEFAULT/interface_driver': value => $interface_driver;
83 if ($external_network_bridge) {
84 neutron_vpnaas_agent_config {
85 'DEFAULT/external_network_bridge': value => $external_network_bridge;
88 neutron_vpnaas_agent_config {
89 'DEFAULT/external_network_bridge': ensure => absent;
93 if $::neutron::params::vpnaas_agent_package {
94 Package['neutron'] -> Package['neutron-vpnaas-agent']
95 Package['neutron-vpnaas-agent'] -> Neutron_vpnaas_agent_config<||>
96 package { 'neutron-vpnaas-agent':
97 ensure => $package_ensure,
98 name => $::neutron::params::vpnaas_agent_package,
101 Package['neutron'] -> Neutron_vpnaas_agent_config<||>
106 $service_ensure = 'running'
108 $service_ensure = 'stopped'
112 service { 'neutron-vpnaas-service':
113 ensure => $service_ensure,
114 name => $::neutron::params::vpnaas_agent_service,
116 require => Class['neutron'],