Do not change OpenVPN key everytime.

This commit is contained in:
yohan 2024-09-29 23:00:34 +02:00
parent 8a9cad5f9a
commit 634e9182c8

View File

@ -14,11 +14,18 @@
changed_when: false
become: true
- name: Check if key file already exists
stat:
path: /usr/local/docker-mounted-files/temp-openvpn-server/temp-p2p-shared.key
register: temp_p2p_shared_key
become: true
- name: Generate temporary P2P shared key
ansible.builtin.command:
cmd: "podman run --rm -i {{ private_registry_domain }}/openvpn:176450680a --genkey secret"
register: openvpn_genkey_result
become: true
when: not temp_p2p_shared_key.stat.exists
- name: Template key file
ansible.builtin.template:
@ -33,6 +40,7 @@
- temp-p2p-shared.key
vars:
temp_p2p_shared_key: "{{ openvpn_genkey_result.stdout }}"
when: not temp_p2p_shared_key.stat.exists
- name: Create temp-openvpn-server container
containers.podman.podman_container: