forked from GovStackWorkingGroup/IM_Demo_InstallingScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
use_certs.yml
70 lines (57 loc) · 1.67 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
---
- 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
- 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