From fafddef404ab68081a30a83b1d606e26c905702c Mon Sep 17 00:00:00 2001 From: Kyle Lexmond Date: Tue, 24 Dec 2024 22:47:36 +0000 Subject: [PATCH] Change openvpn_client_config_dir to have openvpn_base_dir as a prefix (Fix Error on default openvpn_client_config_dir #197) --- defaults/main/openvpn.yml | 2 +- tasks/config.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/defaults/main/openvpn.yml b/defaults/main/openvpn.yml index caf0b0cf..20681f05 100644 --- a/defaults/main/openvpn.yml +++ b/defaults/main/openvpn.yml @@ -49,7 +49,7 @@ openvpn_service_name: "openvpn-server@{{ openvpn_config_file }}.service" # Client config - settings the server will push openvpn_client_config: false -openvpn_client_config_dir: ccd +openvpn_client_config_dir: "{{ openvpn_base_dir }}/ccd" openvpn_client_configs: {} # Example: # openvpn_client_configs: diff --git a/tasks/config.yml b/tasks/config.yml index 1813994a..b43df496 100644 --- a/tasks/config.yml +++ b/tasks/config.yml @@ -78,7 +78,7 @@ - name: Create client config directory ansible.builtin.file: state: directory - path: "{{ openvpn_base_dir }}/{{ openvpn_client_config_dir }}" + path: "{{ openvpn_client_config_dir }}" owner: "{{ openvpn_conf_user }}" group: "{{ openvpn_conf_group }}" mode: "0755" @@ -87,7 +87,7 @@ - name: Create client configs ansible.builtin.template: src: client_ccd.j2 - dest: "{{ openvpn_base_dir }}/{{ openvpn_client_config_dir }}/{{ item.key }}" + dest: "{{ openvpn_client_config_dir }}/{{ item.key }}" owner: "{{ openvpn_conf_user }}" group: "{{ openvpn_conf_group }}" mode: "0644" @@ -95,14 +95,14 @@ with_dict: "{{ openvpn_client_configs }}" - name: List client config directory - ansible.builtin.command: "ls -1 {{ openvpn_base_dir }}/{{ openvpn_client_config_dir }}" + ansible.builtin.command: "ls -1 {{ openvpn_client_config_dir }}" register: __ccd_contents changed_when: false when: openvpn_client_config is truthy - name: Delete undeclared configs in client config directory ansible.builtin.file: - path: "{{ openvpn_base_dir }}/{{ openvpn_client_config_dir }}/{{ item }}" + path: "{{ openvpn_client_config_dir }}/{{ item }}" state: absent when: - item not in (openvpn_client_configs.keys() | list) @@ -111,7 +111,7 @@ - name: Delete client config directory ansible.builtin.file: - path: "{{ openvpn_base_dir }}/{{ openvpn_client_config_dir }}" + path: "{{ openvpn_client_config_dir }}" state: absent when: openvpn_client_config is falsy