diff --git a/roles/role_deploy_temp_openvpn-server/tasks/main.yml b/roles/role_deploy_temp_openvpn-server/tasks/main.yml index ed96e59..dc1d0c9 100644 --- a/roles/role_deploy_temp_openvpn-server/tasks/main.yml +++ b/roles/role_deploy_temp_openvpn-server/tasks/main.yml @@ -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: