Skip to content

Commit

Permalink
Add systemd override for openvpn
Browse files Browse the repository at this point in the history
  • Loading branch information
kyl191 committed Dec 25, 2024
1 parent fafddef commit 48d5ae5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions files/openvpn-server-override.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Service]
ExecStart=
ExecStart=/usr/sbin/openvpn --config %i.conf
16 changes: 16 additions & 0 deletions tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,22 @@
state: absent
when: openvpn_client_config is falsy

- name: Create openvpn service override
when: ansible_service_mgr == "systemd"
block:
- name: Create openvpn service override directory
ansible.builtin.file:
path: /etc/systemd/system/openvpn-server@.service.d
state: directory
owner: root
group: root
mode: "0755"
- name: Copy openvpn service override file
ansible.builtin.copy:
src: openvpn-server-override.conf
dest: /etc/systemd/system/openvpn-server@.service.d/override.conf
mode: "0644"

- name: Setup openvpn auto-start & start
ansible.builtin.service:
name: "{{ openvpn_service_name }}"
Expand Down

0 comments on commit 48d5ae5

Please sign in to comment.