homeassistant: Add installation procedures for nginx

This commit is contained in:
Thomas Basler 2024-10-03 01:04:54 +02:00
parent 6e55e4ff78
commit bd7d256004
6 changed files with 66 additions and 0 deletions

View File

@ -43,3 +43,6 @@ pgadmin4_db_password: "{{ vault_pgadmin4_db_password }}"
pgadmin4_initial_user_email: noby@binary-kitchen.de
pgadmin4_initial_user_password: "{{ vault_pgadmin4_initial_user_password }}"
ha_pg_grafana_db_pass: "{{ vault_ha_pg_grafana_db_pass }}"
ha_domains:
- lasagne.binary.kitchen

View File

@ -14,3 +14,8 @@
ansible.builtin.service:
name: grafana-server
state: restarted
- name: Restart nginx
ansible.builtin.service:
name: nginx
state: restarted

View File

@ -11,3 +11,4 @@ galaxy_info:
dependencies:
- { role: mosquitto }
- { role: pgadmin4 }
- { role: nginx, nginx_ssl: false }

View File

@ -12,3 +12,4 @@
- systemd.yml
- installation.yml
- grafana.yml
- nginx.yml

View File

@ -0,0 +1,15 @@
---
- name: Configure vhost
ansible.builtin.template:
src: vhost.j2
dest: /etc/nginx/sites-available/homeassistant
mode: "0644"
notify: Restart nginx
- name: Enable vhost
ansible.builtin.file:
src: /etc/nginx/sites-available/homeassistant
dest: /etc/nginx/sites-enabled/homeassistant
state: link
notify: Restart nginx

View File

@ -0,0 +1,41 @@
{{ ansible_managed | comment }}
server {
listen 80;
listen [::]:80;
server_name {{ ha_domains | join(' ') }};
proxy_buffering off;
location / {
proxy_pass http://127.0.0.1:8123;
proxy_set_header Host $host;
proxy_redirect http:// https://;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /api/websocket {
proxy_pass http://127.0.0.1:8123;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /grafana {
client_max_body_size 1024M;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://localhost:3000;
}
location = /pgadmin4 { rewrite ^ /pgadmin4/; }
location /pgadmin4 { try_files $uri @pgadmin4; }
location @pgadmin4 {
include uwsgi_params;
uwsgi_pass unix:/run/pgadmin4/pgadmin4.sock;
}
}