2 - name: Check {{ client_name }} key existence
4 path: "{{ nordix_openvpn_easyrsa_path }}/pki/private/{{ client_name }}.key"
5 register: client_privatekey
8 - name: Create client cert and csr
9 command: ./easyrsa --batch --req-cn={{ client_name }} gen-req {{ client_name }} nopass
11 chdir: "{{ nordix_openvpn_easyrsa_path }}"
12 when: client_privatekey.stat.exists == false
13 delegate_to: localhost
15 - name: Copy client key to client_config directory
17 src: "{{ nordix_openvpn_easyrsa_path }}/pki/private/{{ client_name }}.key"
18 dest: "{{ nordix_openvpn_clientconfig }}/keys/"
20 delegate_to: localhost
22 - name: Copy client csr to nordix CA
24 src: "{{ nordix_openvpn_easyrsa_path }}/pki/reqs/{{ client_name }}.req"
28 - name: Check {{ client_name }} csr existence in CA
30 path: "{{ nordix_ca_easyrsa_path }}/pki/reqs/{{ client_name }}.req"
33 - name: Import client csr
34 command: ./easyrsa --batch import-req /tmp/{{ client_name }}.req {{ client_name }}
36 chdir: "{{ nordix_ca_easyrsa_path }}"
37 when: client_csr.stat.exists == false
40 - name: Check {{ client_name }} crt existence in CA
42 path: "{{ nordix_ca_easyrsa_path }}/pki/issued/{{ client_name }}.crt"
45 - name: Sign client csr
46 command: ./easyrsa --batch sign-req client {{ client_name }}
48 chdir: "{{ nordix_ca_easyrsa_path }}"
49 when: client_crt.stat.exists == false
52 - name: Fetch client cert to client-configs/keys/ dir
54 src: "{{ nordix_ca_easyrsa_path }}/pki/issued/{{ client_name }}.crt"
55 dest: "{{ nordix_openvpn_clientconfig }}/keys/"
59 - name: Generate Client .ovpn file
60 script: make_config.sh "{{ client_name }}"
62 chdir: "{{ nordix_openvpn_clientconfig }}/"
64 delegate_to: localhost
66 - name: Log user specific ovpn files location on the console
69 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
70 - "The ovpn file {{ client_name }}.ovpn is located in {{ nordix_openvpn_clientconfig }}/files/{{ client_name }}.ovpn"
71 - "Please share the newly generated {{ client_name }}.ovpn file with user over email with below instructions,"
72 - "1. Please install the openvpn on your laptop. Assuming you using Ubuntu:"
73 - "#sudo apt install openvpn"
74 - "2. Then you need to open the VPN connection using the .ovpn file which contain all the required certificates:"
75 - "#sudo openvpn --config {{ client_name }}.ovpn &"
76 - "3. Now, user should have access to all the VMs directly from your laptop"
77 - "4. In case you use Windows 10 OS, please use the community version of OpenVPN client:"
78 - "https://swupdate.openvpn.org/community/releases/openvpn-install-2.4.8-I602-Win10.exe"
79 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
81 delegate_to: localhost