From f719c93185bf12f46d0613187699c834e46ee6d2 Mon Sep 17 00:00:00 2001 From: Kyle Lexmond Date: Wed, 25 Dec 2024 02:28:10 +0000 Subject: [PATCH] Add systemd override for openvpn --- files/openvpn-server-override.conf | 3 +++ tasks/config.yml | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 files/openvpn-server-override.conf diff --git a/files/openvpn-server-override.conf b/files/openvpn-server-override.conf new file mode 100644 index 00000000..bf5f8d7b --- /dev/null +++ b/files/openvpn-server-override.conf @@ -0,0 +1,3 @@ +[Service] +ExecStart= +ExecStart=/usr/sbin/openvpn --config %i.conf diff --git a/tasks/config.yml b/tasks/config.yml index b43df496..b80c20df 100644 --- a/tasks/config.yml +++ b/tasks/config.yml @@ -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 }}"