Browse Source

Fix systemd configuration of OpenVPN server

The server was not starting.  As a result, the dnsmasq service failed to
start, and the playbook thus failed to run when using the vpn role.
This patch corrects the configuration per instructions from
https://help.ubuntu.com/community/OpenVPN.

OpenVPN PAM configuration moved up to reduce server bouncing as the
playbook runs.  The dependency on service (re)starts between openvpn and
dnsmasq works but feels brittle.
Mike Ashley 8 years ago
parent
commit
1011d76866
2 changed files with 8 additions and 5 deletions
  1. 1
    1
      roles/vpn/handlers/main.yml
  2. 7
    4
      roles/vpn/tasks/openvpn.yml

+ 1
- 1
roles/vpn/handlers/main.yml View File

2
   service: name=dnsmasq state=restarted
2
   service: name=dnsmasq state=restarted
3
 
3
 
4
 - name: restart openvpn
4
 - name: restart openvpn
5
-  service: name=openvpn state=restarted
5
+  service: name=openvpn@server state=restarted

+ 7
- 4
roles/vpn/tasks/openvpn.yml View File

141
   template: src=etc_openvpn_server.conf.j2 dest=/etc/openvpn/server.conf
141
   template: src=etc_openvpn_server.conf.j2 dest=/etc/openvpn/server.conf
142
   notify: restart openvpn
142
   notify: restart openvpn
143
 
143
 
144
+- name: Copy OpenVPN PAM configuration file into place
145
+  copy: src=etc_pam.d_openvpn dest=/etc/pam.d/openvpn
146
+  notify: restart openvpn
147
+
148
+- name: Enable OpenVPN server systemd service unit
149
+  service: name=openvpn@server enabled=yes
150
+
144
 # OpenVPN must restart first so the 10.8.0.0 interface is available
151
 # OpenVPN must restart first so the 10.8.0.0 interface is available
145
 # to dnsmasq
152
 # to dnsmasq
146
 - meta: flush_handlers
153
 - meta: flush_handlers
149
   copy: src=etc_dnsmasq.conf dest=/etc/dnsmasq.conf
156
   copy: src=etc_dnsmasq.conf dest=/etc/dnsmasq.conf
150
   notify: restart dnsmasq
157
   notify: restart dnsmasq
151
 
158
 
152
-- name: Copy OpenVPN PAM configuration file into place
153
-  copy: src=etc_pam.d_openvpn dest=/etc/pam.d/openvpn
154
-  notify: restart openvpn
155
-
156
 - name: Copy the ca.crt and ta.key files that clients will need in order to connect to the OpenVPN server
159
 - name: Copy the ca.crt and ta.key files that clients will need in order to connect to the OpenVPN server
157
   command: cp {{ openvpn_path }}/{{ item[1] }} {{ openvpn_path }}/{{ item[0] }}
160
   command: cp {{ openvpn_path }}/{{ item[1] }} {{ openvpn_path }}/{{ item[0] }}
158
   tags:
161
   tags:

Loading…
Cancel
Save