summaryrefslogtreecommitdiffstats
path: root/roles/openvpn/tasks/keys.yml
blob: dd9f4ec3f7a0ad70586984759c689861c45b1731 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
- name: Copy CA private key
  copy: src="ca/ca.key" dest="{{openvpn_keydir}}/" owner="root" group="root" mode="0400"

- name: OpenSSL generate request
  command: openssl req -subj '/CN={{ ansible_hostname }}' -new -keyout "node.key" -out "node.csr" -batch -nodes chdir="{{openvpn_keydir}}" creates="{{openvpn_keydir}}/node.csr"

- name: Generate CA serial file
  copy: content="01" dest="{{openvpn_keydir}}/ca.srl"

- name: OpenSSL sign the request
  command: openssl x509 -req -days 3650 -in "node.csr" -CA "ca.crt" -CAkey "ca.key" -out "node.crt" chdir="{{openvpn_keydir}}" creates="{{openvpn_keydir}}/node.crt"
  notify:
    - openvpn