1
0
forked from infra/ansible

new host: strontium (Rocket.Chat)

This commit is contained in:
Markus 2020-01-08 12:03:28 +01:00
parent 871add3b0e
commit f23d71aa6a
9 changed files with 143 additions and 1 deletions

View File

@ -85,6 +85,8 @@ prosody_domain: jabber.binary-kitchen.de
radius_secret: "{{ vault_radius_secret }}"
rocketchat_domain: chat.binary-kitchen.de
root_keys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJBmZnJLG1WRppbLtOAJw3E4LgLRK0NirfCgpovhhU6h moepman"
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINPlktM2x11cNBMKurf57MLE1XcOm2sGQXguc0tl1vYd kishi"

View File

@ -0,0 +1,4 @@
---
root_keys_host:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINkN1eqP1Mv29z0npVznVJ4Cumyf4EoqS44xHKl0ms0e timo@charon"

1
hosts
View File

@ -20,3 +20,4 @@ oxygen.binary-kitchen.net
fluorine.binary-kitchen.net
neon.binary-kitchen.net
krypton.binary-kitchen.net
strontium.binary-kitchen.net

View File

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

View File

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

View File

@ -0,0 +1,60 @@
---
- name: Create user
user: name=rocketchat
- name: Enable https for apt
apt: name=apt-transport-https
- name: Enable mongodb apt-key
apt_key: url="https://www.mongodb.org/static/pgp/server-4.0.asc"
- name: Enable mongodb repository
apt_repository: repo="deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main"
# mongodb needs libcurl3 which is no longer available in buster
- name: Enable stretch repository
apt_repository: repo="deb http://deb.debian.org/debian/ stretch main"
- name: Enable nodesource apt-key
apt_key: url="https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
- name: Enable nodesource repository
apt_repository: repo="deb https://deb.nodesource.com/node_8.x/ {{ ansible_distribution_release }} main"
- name: Pin nodejs repository
blockinfile:
path: /etc/apt/preferences.d/nodejs
create: yes
block: |
Package: *
Pin: origin deb.nodesource.com
Pin-Priority: 600
- name: Install packages
apt: name={{ item }}
with_items:
- build-essential
- dirmngr
- graphicsmagick
- libcurl3
- mongodb-org
- nodejs
# rocket.chat itself is not setup here - it is done manually
- name: Ensure certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ rocketchat_domain }}.key -out /etc/nginx/ssl/{{ rocketchat_domain }}.crt -days 730 -subj "/CN={{ rocketchat_domain }}" creates=/etc/nginx/ssl/{{ rocketchat_domain }}.crt
notify: Restart nginx
- name: Configure certificate manager for rocketchat
template: src=certs.j2 dest=/etc/acertmgr/{{ rocketchat_domain }}.conf
notify: Run acertmgr
- name: Configure vhost
template: src=vhost.j2 dest=/etc/nginx/sites-available/rocketchat
notify: Restart nginx
- name: Enable vhost
file: src=/etc/nginx/sites-available/rocketchat dest=/etc/nginx/sites-enabled/rocketchat state=link
notify: Restart nginx

View File

@ -0,0 +1,15 @@
---
{{ rocketchat_domain }}:
- path: /etc/nginx/ssl/{{ rocketchat_domain }}.key
user: root
group: root
perm: '400'
format: key
action: '/usr/sbin/service nginx restart'
- path: /etc/nginx/ssl/{{ rocketchat_domain }}.crt
user: root
group: root
perm: '400'
format: crt,ca
action: '/usr/sbin/service nginx restart'

View File

@ -0,0 +1,43 @@
server {
listen 80;
listen [::]:80;
server_name {{ rocketchat_domain }};
location /.well-known/acme-challenge {
default_type "text/plain";
alias /var/www/acme-challenge;
}
location / {
return 301 https://{{ rocketchat_domain }}$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name {{ rocketchat_domain }};
ssl_certificate_key /etc/nginx/ssl/{{ rocketchat_domain }}.key;
ssl_certificate /etc/nginx/ssl/{{ rocketchat_domain }}.crt;
location / {
client_max_body_size 128M;
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
}

View File

@ -8,7 +8,7 @@
- root-keys
- name: Setup unattended updates
hosts: [sulis.binary.kitchen, nabia.binary.kitchen, beryllium.binary-kitchen.net, boron.binary-kitchen.net, carbon.binary-kitchen.net, nitrogen.binary-kitchen.net, oxygen.binary-kitchen.net, fluorine.binary-kitchen.net, krypton.binary-kitchen.net]
hosts: [sulis.binary.kitchen, nabia.binary.kitchen, beryllium.binary-kitchen.net, boron.binary-kitchen.net, carbon.binary-kitchen.net, nitrogen.binary-kitchen.net, oxygen.binary-kitchen.net, fluorine.binary-kitchen.net, krypton.binary-kitchen.net, strontium.binary-kitchen.net]
roles:
- uau
@ -82,3 +82,8 @@
hosts: krypton.binary-kitchen.net
roles:
- partdb
- name: Setup rocketchat server
hosts: strontium.binary-kitchen.net
roles:
- rocketchat