From 59cca157e2b90186fdc83754c58a3ba0bcd5b7bc Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Tue, 2 Oct 2018 18:35:30 +0200 Subject: [PATCH] web: new domain makerspace-regensburg.de --- roles/web/files/certs | 14 ++++++++++++++ roles/web/files/vhost | 30 ++++++++++++++++++++++++++++++ roles/web/tasks/main.yml | 4 ++++ 3 files changed, 48 insertions(+) diff --git a/roles/web/files/certs b/roles/web/files/certs index a8c887f..99f51a7 100644 --- a/roles/web/files/certs +++ b/roles/web/files/certs @@ -27,3 +27,17 @@ www.ccc-r.de: perm: '400' format: key action: '/usr/sbin/service nginx restart' + +www.makerspace-regensburg.de: +- path: /etc/nginx/ssl/www.makerspace-regensburg.de.crt + user: root + group: root + perm: '400' + format: crt,ca + action: '/usr/sbin/service nginx restart' +- path: /etc/nginx/ssl/www.makerspace-regensburg.de.key + user: root + group: root + perm: '400' + format: key + action: '/usr/sbin/service nginx restart' diff --git a/roles/web/files/vhost b/roles/web/files/vhost index 8641b53..0573e18 100644 --- a/roles/web/files/vhost +++ b/roles/web/files/vhost @@ -98,3 +98,33 @@ server { default_type text/html; } + +server { + listen 80; + listen [::]:80; + + server_name makerspace-regensburg.de www.makerspace-regensburg.de; + + location /.well-known/acme-challenge { + default_type "text/plain"; + alias /var/www/acme-challenge; + } + + location / { + return 301 https://www.makerspace-regensburg.de$request_uri; + } +} + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + + server_name www.makerspace-regensburg.de; + + ssl_certificate_key /etc/nginx/ssl/www.makerspace-regensburg.de.key; + ssl_certificate /etc/nginx/ssl/www.makerspace-regensburg.de.crt; + + root /var/www/makerspace-regensburg; + + default_type text/html; +} diff --git a/roles/web/tasks/main.yml b/roles/web/tasks/main.yml index 57e5428..7a3bb3f 100644 --- a/roles/web/tasks/main.yml +++ b/roles/web/tasks/main.yml @@ -19,6 +19,10 @@ command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/www.ccc-r.de.key -out /etc/nginx/ssl/www.ccc-r.de.crt -days 730 -subj "/CN=www.ccc-r.de" creates=/etc/nginx/ssl/www.ccc-r.de.crt notify: Restart nginx +- name: Ensure (MS-R) certificates are available + command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/www.makerspace-regensburg.de.key -out /etc/nginx/ssl/www.makerspace-regensburg.de.crt -days 730 -subj "/CN=www.makerspace-regensburg.de" creates=/etc/nginx/ssl/www.makerspace-regensburg.de.crt + notify: Restart nginx + - name: Configure certificate manager copy: src=certs dest=/etc/acme/domains.d/www.binary-kitchen.de.conf notify: Run certmgr