feat: Add nginx-proxy role for nginx and certbot

This commit is contained in:
gemini
2026-03-01 22:23:38 +01:00
parent 90cbc8813c
commit e3dcd0158c
9 changed files with 241 additions and 25 deletions

View File

@@ -0,0 +1,48 @@
---
- name: Install Nginx
ansible.builtin.apt:
name: nginx
state: present
- name: Ensure Nginx is enabled and started
ansible.builtin.service:
name: nginx
state: started
enabled: true
- name: Create Nginx includes directory
ansible.builtin.file:
path: /etc/nginx/conf.d/include
state: directory
mode: '0755'
- name: Create proxy.conf include
ansible.builtin.copy:
content: |
add_header X-Served-By $host;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass $forward_scheme://$server:$port$request_uri;
dest: /etc/nginx/conf.d/include/proxy.conf
- name: Create internal.conf include (access rules)
ansible.builtin.copy:
content: |
deny 192.168.5.1;
allow 192.168.100.0/24;
allow 10.0.0.1/24;
deny all;
satisfy all;
dest: /etc/nginx/conf.d/include/internal.conf
- name: Create upgrade.conf include
ansible.builtin.copy:
content: |
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass_header X-Transmission-Session-Id;
dest: /etc/nginx/conf.d/include/upgrade.conf