--- - name: "Check if the easy-rsa is installed" register: client_rsa stat: "path=/etc/openvpn/ca.crt" - name: "Creating Client certificate" delegate_to: "{{ server }}" shell: " cd /etc/easy-rsa/2.0; source ./vars; export EASY_RSA=\"${EASY_RSA:-.}\"; \"$EASY_RSA\"/pkitool --csr {{ inventory_hostname }} ;\"$EASY_RSA\"/pkitool --sign {{ inventory_hostname }}" when: "client_rsa.stat.exists == false" - name: "Copy the Client Certificate to the master node" delegate_to: "{{ server }}" fetch: "src=/etc/easy-rsa/2.0/keys/{{ inventory_hostname }}.crt dest=/tmp/{{ inventory_hostname }}/ fail_on_missing=yes validate_md5=yes flat=yes" when: "client_rsa.stat.exists == false" - name: "Copy the Client Certificate to the master node" delegate_to: "{{ server }}" fetch: "src=/etc/easy-rsa/2.0/keys/{{ inventory_hostname }}.key dest=/tmp/{{ inventory_hostname }}/ fail_on_missing=yes validate_md5=yes flat=yes" when: "client_rsa.stat.exists == false" - name: "Copy the Client Certificate to the master node" delegate_to: "{{ server }}" fetch: "src=/etc/easy-rsa/2.0/keys/ca.crt dest=/tmp/{{ inventory_hostname }}/ fail_on_missing=yes validate_md5=yes flat=yes" when: "client_rsa.stat.exists == false"