new host: magnesium (partdb/partkeepr)

This commit is contained in:
Kishi85 2018-12-17 19:22:30 +01:00
parent 7f59fa64a6
commit 3425fdeac9
7 changed files with 104 additions and 0 deletions

1
hosts
View File

@ -20,3 +20,4 @@ oxygen.binary-kitchen.net
fluorine.binary-kitchen.net
neon.binary-kitchen.net
sodium.binary-kitchen.net
magnesium.binary-kitchen.net

14
roles/partdb/files/certs Normal file
View File

@ -0,0 +1,14 @@
---
partdb.binary-kitchen.de:
- path: /etc/nginx/ssl/partdb.binary-kitchen.de.crt
user: root
group: root
perm: '400'
format: crt,ca
action: '/usr/sbin/service nginx restart'
- path: /etc/nginx/ssl/partdb.binary-kitchen.de.key
user: root
group: root
perm: '400'
format: key
action: '/usr/sbin/service nginx restart'

40
roles/partdb/files/vhost Normal file
View File

@ -0,0 +1,40 @@
server {
listen 80;
listen [::]:80;
server_name partdb.binary-kitchen.de;
location /.well-known/acme-challenge {
default_type "text/plain";
alias /var/www/acme-challenge;
}
location / {
return 301 https://partdb.binary-kitchen.de$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name partdb.binary-kitchen.de;
ssl_certificate_key /etc/nginx/ssl/partdb.binary-kitchen.de.key;
ssl_certificate /etc/nginx/ssl/partdb.binary-kitchen.de.crt;
root /var/www/partdb;
client_max_body_size 32M;
index index.php;
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_intercept_errors on;
}
}

View File

@ -0,0 +1,7 @@
---
- name: Restart nginx
service: name=nginx state=restarted
- name: Run certmgr
command: /opt/acertmgr/acertmgr.py

View File

@ -0,0 +1,5 @@
---
dependencies:
- { role: certmgr }
- { role: nginx, nginx_ssl: True }

View File

@ -0,0 +1,31 @@
---
- name: Install dependencies
apt: name={{ item }}
with_items:
- php7.0-fpm
- php7.0-ldap
- php7.0-sqlite3
- php7.0-xml
- name: Create vhost directory
file: path=/var/www/partdb state=directory owner=www-data group=www-data
- name: Ensure partdb certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/partdb.binary-kitchen.de.key -out /etc/nginx/ssl/partdb.binary-kitchen.de.crt -days 730 -subj "/CN=partdb.binary-kitchen.de" creates=/etc/nginx/ssl/partdb.binary-kitchen.de.crt
notify: Restart nginx
- name: Configure certificate manager
copy: src=certs dest=/etc/acme/domains.d/partdb.binary-kitchen.de.conf
notify: Run certmgr
- name: Configure vhosts
copy: src=vhost dest=/etc/nginx/sites-available/www
notify: Restart nginx
- name: Enable vhosts
file: src=/etc/nginx/sites-available/www dest=/etc/nginx/sites-enabled/www state=link
notify: Restart nginx
- name: Start php7.0-fpm
service: name=php7.0-fpm state=started enabled=yes

View File

@ -93,3 +93,9 @@
hosts: sodium.binary-kitchen.net
roles:
- uau
- name: Setup partdb server
hosts: magnesium.binary-kitchen.net
roles:
- partdb
- uau