File tree Expand file tree Collapse file tree 6 files changed +15
-9
lines changed Expand file tree Collapse file tree 6 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -208,6 +208,12 @@ openvpn_script_output_directories: []
208208# A path on the OpenVPN server where OpenVPN scripts should be uploaded to.
209209openvpn_scripts_dir : " {{ openvpn_etcdir }}/scripts/"
210210
211+ # In some distros, the server with `foobar.conf` config file can be managed
212+ # using `openvpn@foobar` service
213+ openvpn_config_file : " {{ openvpn_etcdir }}/server.conf"
214+
215+ openvpn_client_config_dir : " {{ openvpn_client_config_dir }}"
216+
211217# A list of files located on the Ansible controller that the role should upload.
212218# The scripts will be uploaded under `openvpn_scripts_dir`. You can reference
213219# them in `openvpn_server_options` for the OpenVPN configuration option you
Original file line number Diff line number Diff line change 22
33- name : Generate tls-auth key
44 command :
5- openvpn --genkey --secret "{{ openvpn_etcdir }}/ovpns /{{ openvpn_tls_key }}"
5+ openvpn --genkey --secret "{{ openvpn_client_config_dir }}/{{ openvpn_tls_key }}"
66 args :
7- creates : " {{ openvpn_etcdir }}/ovpns /{{ openvpn_tls_key }}"
7+ creates : " {{ openvpn_client_config_dir }}/{{ openvpn_tls_key }}"
88 when : openvpn_tls_auth
Original file line number Diff line number Diff line change 33- name : Generate client configurations
44 template :
55 src : " {{ openvpn_client_conf_template }}"
6- dest : " {{ openvpn_etcdir }}/ovpns /{{ item }}.ovpn"
6+ dest : " {{ openvpn_client_config_dir }}/{{ item }}.ovpn"
77 loop : " {{ openvpn_clients }}"
88 register : openvpn_clients_changed
99
2020 loop_control :
2121 index_var : index
2222 args :
23- chdir : " {{ openvpn_etcdir }}/ovpns/ "
23+ chdir : " {{ openvpn_client_config_dir }}"
2424 when : openvpn_clients_changed.results[index] is changed
2525
2626- name : Download client credentials
2727 fetch :
28- src : " {{ openvpn_etcdir }}/ovpns /{{ item }}.zip"
28+ src : " {{ openvpn_client_config_dir }}/{{ item }}.zip"
2929 dest : " {{ openvpn_download_dir }}"
3030 flat : true
3131 validate_checksum : true
Original file line number Diff line number Diff line change 1515- name : Configure server
1616 template :
1717 src : server.conf.j2
18- dest : " {{ openvpn_etcdir }}/server.conf "
18+ dest : " {{ openvpn_config_file }}"
1919 notify : openvpn restart
2020
2121# Needed by both tls-authentication tasks and client-configuration tasks. Placed
2222# here to avoid repeating it twice in both places where the tls and
2323# client-config tasks are located.
2424- name : Create client configuration directory
2525 file :
26- path : " {{ openvpn_etcdir }}/ovpns "
26+ path : " {{ openvpn_client_config_dir }}"
2727 state : directory
Original file line number Diff line number Diff line change 77
88- name : Read TLS-auth key
99 slurp :
10- src : " {{ openvpn_etcdir }}/ovpns /{{ openvpn_tls_key }}"
10+ src : " {{ openvpn_client_config_dir }}/{{ openvpn_tls_key }}"
1111 no_log : true
1212 register : openvpn_read_tlsauth_file_results
1313 changed_when : false
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ dh {{ openvpn_keydir }}/dh.pem
5252
5353{% if openvpn_tls_auth -%}
5454# Use a static pre-shared key (PSK)
55- tls-auth {{ openvpn_etcdir }}/ovpns /{{ openvpn_tls_key }} 0
55+ tls-auth {{ openvpn_client_config_dir }}/{{ openvpn_tls_key }} 0
5656tls-server
5757{% endif %}
5858
You can’t perform that action at this time.
0 commit comments