|
@@ -21,13 +21,13 @@
|
21
|
21
|
|
22
|
22
|
- name: Create directories for clients
|
23
|
23
|
file: path={{ openvpn_path}}/{{ item }} state=directory
|
24
|
|
- with_items: openvpn_clients
|
|
24
|
+ with_items: "{{ openvpn_clients }}"
|
25
|
25
|
|
26
|
26
|
- name: Generate RSA keys for the clients
|
27
|
27
|
command: openssl genrsa -out client.key {{ openvpn_key_size }}
|
28
|
28
|
chdir={{ openvpn_path }}/{{ item }}
|
29
|
29
|
creates=client.key
|
30
|
|
- with_items: openvpn_clients
|
|
30
|
+ with_items: "{{ openvpn_clients }}"
|
31
|
31
|
|
32
|
32
|
- name: Set the proper permissions on all RSA keys
|
33
|
33
|
file: path={{ openvpn_path }}
|
|
@@ -73,13 +73,13 @@
|
73
|
73
|
command: openssl req -new -key client.key -out client.csr -subj "{{ openssl_request_subject }}/CN={{ item }}"
|
74
|
74
|
chdir={{ openvpn_path }}/{{ item }}
|
75
|
75
|
creates=client.csr
|
76
|
|
- with_items: openvpn_clients
|
|
76
|
+ with_items: "{{ openvpn_clients }}"
|
77
|
77
|
|
78
|
78
|
- name: Generate certificates for the clients
|
79
|
79
|
command: openssl x509 -CA {{ openvpn_ca }}.crt -CAkey {{ openvpn_ca }}.key -CAcreateserial -req -days {{ openvpn_days_valid }} -in client.csr -out client.crt
|
80
|
80
|
chdir={{ openvpn_path }}/{{ item }}
|
81
|
81
|
creates=client.crt
|
82
|
|
- with_items: openvpn_clients
|
|
82
|
+ with_items: "{{ openvpn_clients }}"
|
83
|
83
|
|
84
|
84
|
- name: Generate HMAC firewall key
|
85
|
85
|
command: openvpn --genkey --secret {{ openvpn_hmac_firewall }}
|
|
@@ -93,13 +93,13 @@
|
93
|
93
|
- name: Register client certificate contents
|
94
|
94
|
command: cat client.crt
|
95
|
95
|
chdir={{ openvpn_path }}/{{ item }}
|
96
|
|
- with_items: openvpn_clients
|
|
96
|
+ with_items: "{{ openvpn_clients }}"
|
97
|
97
|
register: openvpn_client_certificates
|
98
|
98
|
|
99
|
99
|
- name: Register client key contents
|
100
|
100
|
command: cat client.key
|
101
|
101
|
chdir={{ openvpn_path }}/{{ item }}
|
102
|
|
- with_items: openvpn_clients
|
|
102
|
+ with_items: "{{ openvpn_clients }}"
|
103
|
103
|
register: openvpn_client_keys
|
104
|
104
|
|
105
|
105
|
- name: Register HMAC firewall contents
|
|
@@ -111,9 +111,9 @@
|
111
|
111
|
template: src=client.cnf.j2
|
112
|
112
|
dest={{ openvpn_path }}/{{ item[0] }}/{{ openvpn_server }}.ovpn
|
113
|
113
|
with_together:
|
114
|
|
- - openvpn_clients
|
115
|
|
- - openvpn_client_certificates.results
|
116
|
|
- - openvpn_client_keys.results
|
|
114
|
+ - "{{ openvpn_clients }}"
|
|
115
|
+ - "{{ openvpn_client_certificates.results }}"
|
|
116
|
+ - "{{ openvpn_client_keys.results }}"
|
117
|
117
|
|
118
|
118
|
- name: Generate Diffie-Hellman parameters (this will take a while)
|
119
|
119
|
command: openssl dhparam -out {{ openvpn_dhparam }} {{ openvpn_key_size }}
|