Skip to content

Commit

Permalink
Allow to provide custom configuration for VPNaaS
Browse files Browse the repository at this point in the history
As we need to monitor vpn connection detailes, the only way to config vpnaas to log states and connections of vpn
is to provide own templates for VPNaaS configuration. With that we enable deployers to provide custom configuration
files for using with any vpn drivers (stronswan/openswan).

Co-Authored-By: Dmitriy Rabotyagov <[email protected]>
Change-Id: I54dbd5c9690281af475312a277eab534403edf92
(cherry picked from commit 26b768e)
  • Loading branch information
shahabtaee committed Jun 29, 2022
1 parent 713ae64 commit 7898c61
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 2 deletions.
8 changes: 8 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,14 @@ neutron_nova_metadata_insecure: "{{ nova_metadata_insecure | default(False) }}"
neutron_driver_vpnaas: "{{ _neutron_driver_vpnaas }}"
neutron_vpnaas_service_provider: "{{ _neutron_vpnaas_service_provider }}"

#Set this variable to use custom config file for strongswan/openswan
# neutron_vpnaas_custom_config:
# - src: "/etc/openstack_deploy/strongswan/strongswan.conf.template"
# dest: "{{ neutron_conf_dir }}/strongswan.conf.template"
# condition: "{{ ansible_facts['os_family'] | lower == 'debian' }}"

neutron_vpnaas_custom_config: []

# Calico Felix agent upstream settings
calico_felix_url: "https://github.com/projectcalico/felix/releases/download/{{ calico_felix_version }}/calico-felix-amd64"
calico_felix_version: v3.7.0
Expand Down
35 changes: 33 additions & 2 deletions doc/source/configure-network-services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ Follow the steps below to deploy FWaaS v2:
# openstack-ansible os-neutron-install.yml
Virtual private network service (optional)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Virtual private network service - VPNaaS (optional)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The following procedure describes how to modify the
``/etc/openstack_deploy/user_variables.yml`` file to enable VPNaaS.
Expand Down Expand Up @@ -180,6 +180,37 @@ dict.

.. _conf override: https://docs.openstack.org/openstack-ansible/latest/admin/openstack-operations.html

You can also define customized configuration files for VPN service with the variable
``neutron_vpnaas_custom_config``:

.. code-block:: yaml
neutron_vpnaas_custom_config:
- src: "/etc/openstack_deploy/strongswan/strongswan.conf.template"
dest: "{{ neutron_conf_dir }}/strongswan.conf.template"
condition: "{{ ansible_facts['os_family'] | lower == 'debian' }}"
- src: "/etc/openstack_deploy/strongswan/strongswan.d"
dest: "/etc/strongswan.d"
condition: "{{ ansible_facts['os_family'] | lower == 'debian' }}"
- src: "/etc/openstack_deploy/{{ neutron_vpnaas_distro_packages }}/ipsec.conf.template"
dest: "{{ neutron_conf_dir }}/ipsec.conf.template"
- src: "/etc/openstack_deploy/{{ neutron_vpnaas_distro_packages }}/ipsec.secret.template"
dest: "{{ neutron_conf_dir }}/ipsec.secret.template"
With that ``neutron_l3_agent_ini_overrides`` should be also defined in 'user_variables.yml'
to tell ``l3_agent`` use the new config file:

.. code-block:: yaml
neutron_l3_agent_ini_overrides:
ipsec:
enable_detailed_logging: True
strongswan:
strongswan_config_template : "{{ neutron_conf_dir }}/strongswan.conf.template"
openswan:
ipsec_config_template: "{{ neutron_conf_dir }}/ipsec.conf.template"
BGP Dynamic Routing service (optional)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
features:
- |
Neutron VPN as a Service (VPNaaS) with customized configuration files
can now be defined with the variable ``neutron_vpnaas_custom_config``.
deployers should define ``neutron_vpnaas_custom_config`` in 'user_variables.yml'.
Example:
.. code-block:: yaml
neutron_vpnaas_custom_config:
- src: "/etc/openstack_deploy/strongswan/strongswan.conf.template"
dest: "{{ neutron_conf_dir }}/strongswan.conf.template"
- src: "/etc/openstack_deploy/strongswan/strongswan.d"
dest: "/etc/strongswan.d"
- src: "/etc/openstack_deploy/{{ neutron_vpnaas_distro_packages }}/ipsec.conf.template"
dest: "{{ neutron_conf_dir }}/ipsec.conf.template"
- src: "/etc/openstack_deploy/{{ neutron_vpnaas_distro_packages }}/ipsec.secret.template"
dest: "{{ neutron_conf_dir }}/ipsec.secret.template"
We should be also define ``neutron_l3_agent_ini_overrides`` in 'user_variables.yml'
to tell ``l3_agent`` use the new config file.
Example:
.. code-block:: yaml
neutron_l3_agent_ini_overrides:
ipsec:
enable_detailed_logging: True
strongswan:
strongswan_config_template : "{{ neutron_conf_dir }}/strongswan.conf.template"
openswan:
ipsec_config_template: "{{ neutron_conf_dir }}/ipsec.conf.template"
13 changes: 13 additions & 0 deletions tasks/neutron_post_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,19 @@
when:
- "'bgpvpn' in neutron_plugin_base"

- name: Copy vpnaas custom config files
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "root"
group: "{{ neutron_system_group_name }}"
mode: "0640"
loop: "{{ neutron_vpnaas_custom_config }}"
when:
- neutron_vpnaas_custom_config | length > 0
- neutron_services['neutron-l3-agent']['group'] in group_name
- item.condition | default(True)

- name: Stop haproxy service on debian derivatives with standalone network nodes
service:
name: haproxy
Expand Down

0 comments on commit 7898c61

Please sign in to comment.