-
Notifications
You must be signed in to change notification settings - Fork 2
/
use_certs.yml
106 lines (85 loc) · 2.44 KB
/
use_certs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
- hosts: cs_servers
remote_user: root
vars:
letsencrypt_dir: /etc/letsencrypt
letsencrypt_keys_dir: /etc/letsencrypt/keys
letsencrypt_certs_dir: /etc/letsencrypt/certs
words: "{{ inventory_hostname.split('.') }}"
domain_name: "{{ words[0]+'.ext.'+'.'.join(words[1:]) }}"
tasks:
- name: use private key
file:
dest: /etc/xroad/ssl/nginx.key
src: "{{ letsencrypt_keys_dir }}/{{ domain_name }}.key"
state: link
force: yes
- name: use certificate
file:
dest: /etc/xroad/ssl/nginx.crt
src: "{{ letsencrypt_certs_dir }}/{{ domain_name }}.crt"
state: link
force: yes
- name: restart nginx
service:
name: nginx
state: restarted
- hosts: ss_servers
remote_user: root
vars:
letsencrypt_keys_dir: /etc/letsencrypt/keys
letsencrypt_certs_dir: /etc/letsencrypt/certs
words: "{{ inventory_hostname.split('.') }}"
domain_name: "{{ words[0]+'.ext.'+'.'.join(words[1:]) }}"
tasks:
- name: use generated key
file:
dest: /etc/xroad/ssl/proxy-ui-api.key
src: "{{ letsencrypt_keys_dir }}/{{ domain_name }}.key"
state: link
force: yes
- name: use certificate
file:
dest: /etc/xroad/ssl/proxy-ui-api.crt
src: "{{ letsencrypt_certs_dir }}/{{ domain_name }}.crt"
state: link
force: yes
- name: make p12
openssl_pkcs12:
action: export
certificate_path: /etc/xroad/ssl/proxy-ui-api.crt
privatekey_path: /etc/xroad/ssl/proxy-ui-api.key
path: /etc/xroad/ssl/proxy-ui-api.p12
friendly_name: proxy-ui-api
passphrase: proxy-ui-api
owner: xroad
group: xroad
mode: '0660'
- name: restart ui
service:
name: xroad-proxy-ui-api
state: restarted
- hosts: misp_servers
remote_user: root
vars:
letsencrypt_keys_dir: /etc/letsencrypt/keys
letsencrypt_certs_dir: /etc/letsencrypt/certs
words: "{{ inventory_hostname.split('.') }}"
domain_name: "{{ words[0]+'.ext.'+'.'.join(words[1:]) }}"
tasks:
- name: use generated key
file:
dest: /etc/apache2/ssl/httpsd.key
src: "{{ letsencrypt_keys_dir }}/{{ domain_name }}.key"
state: link
force: yes
- name: use certificate
file:
dest: /etc/apache2/ssl/httpsd.cert
src: "{{ letsencrypt_certs_dir }}/{{ domain_name }}.crt"
state: link
force: yes
- name: restart ui
service:
name: apache2
state: restarted