doorlock: first steps towards an auweg doorlock
This commit is contained in:
parent
b5bfc03f2f
commit
0154bded19
@ -5,6 +5,8 @@ dhcpd_primary: 172.23.13.3
|
||||
|
||||
dns_primary: 172.23.13.3
|
||||
|
||||
doorlock_domain: lock-auweg.binary.kitchen
|
||||
|
||||
name_servers:
|
||||
- 172.23.13.3
|
||||
|
||||
|
7
roles/doorlock/handlers/main.yml
Normal file
7
roles/doorlock/handlers/main.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
- name: Run acertmgr
|
||||
command: /usr/bin/acertmgr
|
||||
|
||||
- name: Restart nginx
|
||||
service: name=nginx state=restarted
|
5
roles/doorlock/meta/main.yml
Normal file
5
roles/doorlock/meta/main.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
|
||||
dependencies:
|
||||
- { role: acertmgr }
|
||||
- { role: nginx, nginx_ssl: True }
|
20
roles/doorlock/tasks/main.yml
Normal file
20
roles/doorlock/tasks/main.yml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
|
||||
- name: Ensure certificates are available
|
||||
command:
|
||||
cmd: >
|
||||
openssl req -x509 -nodes -newkey rsa:2048
|
||||
-keyout /etc/nginx/ssl/{{ doorlock_domain }}.key -out /etc/nginx/ssl/{{ doorlock_domain }}.crt
|
||||
-days 730 -subj "/CN={{ doorlock_domain }}"
|
||||
creates: /etc/nginx/ssl/{{ doorlock_domain }}.crt
|
||||
notify: Restart nginx
|
||||
|
||||
- name: Request nsupdate key for certificate
|
||||
include_role: name=acme-dnskey-generate
|
||||
vars:
|
||||
acme_dnskey_san_domains:
|
||||
- "{{ doorlock_domain }}"
|
||||
|
||||
- name: Configure certificate manager for doorlock
|
||||
template: src=certs.j2 dest=/etc/acertmgr/{{ doorlock_domain }}.conf
|
||||
notify: Run acertmgr
|
18
roles/doorlock/templates/certs.j2
Normal file
18
roles/doorlock/templates/certs.j2
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
|
||||
{{ doorlock_domain }}:
|
||||
- mode: dns.nsupdate
|
||||
nsupdate_server: {{ acme_dnskey_server }}
|
||||
nsupdate_keyfile: {{ acme_dnskey_file }}
|
||||
- path: /etc/nginx/ssl/{{ doorlock_domain }}.key
|
||||
user: root
|
||||
group: root
|
||||
perm: '400'
|
||||
format: key
|
||||
action: '/usr/sbin/service nginx restart'
|
||||
- path: /etc/nginx/ssl/{{ doorlock_domain }}.crt
|
||||
user: root
|
||||
group: root
|
||||
perm: '400'
|
||||
format: crt,ca
|
||||
action: '/usr/sbin/service nginx restart'
|
Loading…
Reference in New Issue
Block a user