From 76b8a3af4fc80aaef808f9ce06de6f221d8c8068 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 15 Jun 2016 19:31:27 +0200 Subject: [PATCH] library/roles/openvpn: support pushing dhcp properties to the clients. infrastructure-services/group_vars/vpn/vpn.yml: Push the internal DNS IP address. --- openvpn/defaults/main.yml | 3 +++ openvpn/templates/openvpn.conf.j2 | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/openvpn/defaults/main.yml b/openvpn/defaults/main.yml index f5c8f4b4..5feb9424 100644 --- a/openvpn/defaults/main.yml +++ b/openvpn/defaults/main.yml @@ -24,6 +24,9 @@ openvpn_server_net: '192.168.254.0 255.255.255.0' openvpn_push_routes: - '192.168.253.0 255.255.255.0' +#openvpn_push_settings: +# - "dhcp-option DNS 10.66.0.4" + openvpn_tls_server: True openvpn_dh: /etc/openvpn/dh2048.pem openvpn_tls_auth: '/etc/openvpn/ta.key 0' diff --git a/openvpn/templates/openvpn.conf.j2 b/openvpn/templates/openvpn.conf.j2 index ac782b14..cc08d93c 100644 --- a/openvpn/templates/openvpn.conf.j2 +++ b/openvpn/templates/openvpn.conf.j2 @@ -7,6 +7,16 @@ ifconfig-pool-persist ipp/ipp.txt push "route {{ route }}" {% endfor %} +{% for route in openvpn_push_routes %} +push "route {{ route }}" +{% endfor %} + +{% if openvpn_push_settings is defined %} +{% for dhcp_opt in openvpn_push_settings %} +push "{{ dhcp_opt }}" +{% endfor %} +{% endif %} + port {{ openvpn_port }} proto {{ openvpn_protocol }}