2 - name: Generate random password for User
4 random_password: "{{ lookup('password', '/dev/null chars=ascii_lowercase,ascii_uppercase,digits length=12') }}"
6 - name: Generate User Private Key
8 path: "/root/CA/private/{{ user_name }}.key"
9 passphrase: "{{ random_password }}"
15 - name: Generate CSR for user {{ user_name }}
17 path: "/root/CA/requests/{{ user_name }}.csr"
18 privatekey_path: "/root/CA/private/{{ user_name }}.key"
19 privatekey_passphrase: "{{ random_password }}"
21 country_name: "{{ country }}"
22 state_or_province_name: "{{ province }}"
23 organization_name: "{{ org }}"
24 organizational_unit_name: "{{ orgunit }}"
25 common_name: "{{ email }}"
28 - name: Sign the CSR request for user {{ user_name }}
30 path: "/root/CA/newcerts/{{ user_name }}.crt"
31 csr_path: "/root/CA/requests/{{ user_name }}.csr"
32 ownca_path: /root/CA/certs/ca.crt
33 ownca_privatekey_path: /root/CA/private/ca.key
37 - name: Fetch the CA, user {{ user_name }} cert and key
40 dest: "{{ hostvars['localhost']['vpn_user_files_location'] }}/"
45 - "/root/CA/newcerts/{{ user_name }}.crt"
46 - "/root/CA/private/{{ user_name }}.key"
48 - name: Keep User random password for temporary use
50 content: "{{ random_password }}"
51 dest: "{{ hostvars['localhost']['vpn_user_files_location'] }}/{{ user_name }}.pwd"
53 delegate_to: localhost