2 - name: Copy client csr to nordix CA
4 src: "{{ hostvars['localhost']['vpn_user_files_location'] }}/{{ user_name }}.req"
11 - name: Check {{ user_name }} csr existence in CA
13 path: "{{ nordix_ca_easyrsa_path }}/pki/reqs/{{ user_name }}.req"
16 - name: Import client csr
17 command: ./easyrsa --batch import-req /tmp/{{ user_name }}.req {{ user_name }}
19 chdir: "{{ nordix_ca_easyrsa_path }}"
20 when: client_csr.stat.exists == false
23 - name: Check {{ user_name }} crt existence in CA
25 path: "{{ nordix_ca_easyrsa_path }}/pki/issued/{{ user_name }}.crt"
28 - name: Sign client csr
29 command: ./easyrsa --batch sign-req client {{ user_name }}
31 chdir: "{{ nordix_ca_easyrsa_path }}"
32 when: client_crt.stat.exists == false
35 - name: Fetch client cert to client-configs/keys/ dir
37 src: "{{ nordix_ca_easyrsa_path }}/pki/issued/{{ user_name }}.crt"
38 dest: "{{ hostvars['localhost']['vpn_user_files_location'] }}/"
42 - name: Copy client cert file to OpenVPN server
44 src: "{{ hostvars['localhost']['vpn_user_files_location'] }}/{{ user_name }}.crt"
45 dest: "{{ nordix_openvpn_clientconfig }}/keys/"
49 - name: Generate Client .ovpn file
50 script: make_config.sh "{{ user_name }}"
52 chdir: "{{ nordix_openvpn_clientconfig }}/"
57 - name: Fetch Client .ovpn file
59 src: "{{ nordix_openvpn_clientconfig }}/files/{{ item|basename }}"
60 dest: "{{ hostvars['localhost']['vpn_user_files_location'] }}/"
63 - "{{ user_name }}.ovpn"
67 - name: Log user specific ovpn files location on the console
70 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
71 - "The ovpn file {{ user_name }}.ovpn is located in {{ nordix_openvpn_clientconfig }}/files/{{ user_name }}.ovpn"
72 - "Please share the newly generated {{ user_name }}.ovpn file with user over email with below instructions,"
73 - "1. Please install the openvpn on your laptop. Assuming you using Ubuntu:"
74 - "#sudo apt install openvpn"
75 - "2. Then you need to open the VPN connection using the .ovpn file which contain all the required certificates:"
76 - "#sudo openvpn --config {{ user_name }}.ovpn &"
77 - "3. Now, user should have access to all the VMs directly from your laptop"
78 - "4. In case you use Windows 10 OS, please use the community version of OpenVPN client:"
79 - "https://swupdate.openvpn.org/community/releases/openvpn-install-2.4.8-I602-Win10.exe"
80 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
82 delegate_to: localhost