Skip to content

Commit de98bc1

Browse files
authored
Openvpn client config pr 2.x (#2299)
* Allowing openvpn role to set up a client config location. * Refactoring openvpn role into blocks and creating client config directory. * Removing MIT GPG server from defaults. * We will need to delete default push routes if client config provides them.
1 parent 63ba8d9 commit de98bc1

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

roles/debian/openvpn/defaults/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ openvpn:
1818
# See --client-config-dir in the manual - https://openvpn.net/community-resources/reference-manual-for-openvpn-2-0/
1919
# This can be useful for activities such as providing a long list of push routes to manage as an include.
2020
client_config_dir: "" # empty means this will not be set
21+
client_config_push_routes: false # if you are providing push routes in your client config, set this to true to remove the default ones
2122
# PAM and LDAP authentication
2223
pam:
2324
enabled: false # relies on `openvpn-plugin-auth-pam.so` which is bundled with OpenVPN server for Debian

roles/debian/openvpn/tasks/main.yml

+10
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@
115115
- name: Set up client config directory.
116116
when: openvpn.client_config_dir | length > 0
117117
block:
118+
- name: Remove default push-route.
119+
ansible.builtin.lineinfile:
120+
path: /etc/openvpn/server.conf
121+
search_string: 'redirect-gateway'
122+
state: absent
123+
owner: root
124+
group: root
125+
mode: '0644'
126+
when: openvpn.client_config_push_routes
127+
118128
- name: Create client config directory if it doesn't exist.
119129
ansible.builtin.file:
120130
path: "{{ openvpn.client_config_dir }}"

0 commit comments

Comments
 (0)