Skip to content

Commit

Permalink
Change openvpn_client_config_dir to have openvpn_base_dir as a prefix…
Browse files Browse the repository at this point in the history
… (Fix Error on default openvpn_client_config_dir #197)
  • Loading branch information
kyl191 committed Dec 24, 2024
1 parent 1c47eda commit fafddef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion defaults/main/openvpn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -87,22 +87,22 @@
- 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"
when: openvpn_client_config is truthy
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)
Expand All @@ -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

Expand Down

0 comments on commit fafddef

Please sign in to comment.