web_mc: webserver for minecraft map
This commit is contained in:
parent
482ac2078d
commit
39e5ad9e20
@ -100,6 +100,8 @@ matrix_dbname: matrix
|
||||
matrix_dbuser: matrix
|
||||
matrix_dbpass: "{{ vault_matrix_dbpass }}"
|
||||
|
||||
mc_domain: minecraft.binary-kitchen.de
|
||||
|
||||
nextcloud_domain: oc.binary-kitchen.de
|
||||
nextcloud_dbname: owncloud
|
||||
nextcloud_dbuser: owncloud
|
||||
|
7
roles/web_mc/handlers/main.yml
Normal file
7
roles/web_mc/handlers/main.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
- name: Restart nginx
|
||||
service: name=nginx state=restarted
|
||||
|
||||
- name: Run acertmgr
|
||||
command: /usr/bin/acertmgr
|
5
roles/web_mc/meta/main.yml
Normal file
5
roles/web_mc/meta/main.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
|
||||
dependencies:
|
||||
- { role: acertmgr }
|
||||
- { role: nginx, nginx_ssl: True }
|
20
roles/web_mc/tasks/main.yml
Normal file
20
roles/web_mc/tasks/main.yml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
|
||||
- name: Create vhost directory
|
||||
file: path=/var/www/mc state=directory owner=www-data group=www-data
|
||||
|
||||
- name: Ensure certificates are available
|
||||
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ mc_domain }}.key -out /etc/nginx/ssl/{{ mc_domain }}.crt -days 730 -subj "/CN={{ mc_domain }}" creates=/etc/nginx/ssl/{{ mc_domain }}.crt
|
||||
notify: Restart nginx
|
||||
|
||||
- name: Configure certificate manager
|
||||
template: src=certs.j2 dest=/etc/acertmgr/{{ mc_domain }}.conf
|
||||
notify: Run acertmgr
|
||||
|
||||
- name: Configure vhosts
|
||||
template: src=vhost.j2 dest=/etc/nginx/sites-available/mc
|
||||
notify: Restart nginx
|
||||
|
||||
- name: Enable vhosts
|
||||
file: src=/etc/nginx/sites-available/mc dest=/etc/nginx/sites-enabled/mc state=link
|
||||
notify: Restart nginx
|
15
roles/web_mc/templates/certs.j2
Normal file
15
roles/web_mc/templates/certs.j2
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
|
||||
{{ mc_domain }}:
|
||||
- path: /etc/nginx/ssl/{{ mc_domain }}.key
|
||||
user: root
|
||||
group: root
|
||||
perm: '400'
|
||||
format: key
|
||||
action: '/usr/sbin/service nginx restart'
|
||||
- path: /etc/nginx/ssl/{{ mc_domain }}.crt
|
||||
user: root
|
||||
group: root
|
||||
perm: '400'
|
||||
format: crt,ca
|
||||
action: '/usr/sbin/service nginx restart'
|
27
roles/web_mc/templates/vhost.j2
Normal file
27
roles/web_mc/templates/vhost.j2
Normal file
@ -0,0 +1,27 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name {{ mc_domain }};
|
||||
|
||||
location /.well-known/acme-challenge {
|
||||
default_type "text/plain";
|
||||
alias /var/www/acme-challenge;
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://{{ mc_domain }}$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
server_name {{ plk_domain }};
|
||||
|
||||
ssl_certificate_key /etc/nginx/ssl/{{ mc_domain }}.key;
|
||||
ssl_certificate /etc/nginx/ssl/{{ mc_domain }}.crt;
|
||||
|
||||
root /var/www/mc;
|
||||
}
|
Loading…
Reference in New Issue
Block a user