summaryrefslogtreecommitdiffstats
path: root/roles/wg_portal/tasks
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-06-17 18:37:49 +0200
committerAhmed Abdelhalim <[email protected]>2026-06-17 18:42:02 +0200
commitc7a4dfce1ad0b545b05a8043e321ad49e48873a6 (patch)
treefe8a0bfc1bc31dc93a8138cce179df2416875bf4 /roles/wg_portal/tasks
parentd9dcfdd822f90eb65117523d7c15694fae952bd2 (diff)
Refactor pi roles to use .home.arpa subdomains for services
Diffstat (limited to 'roles/wg_portal/tasks')
-rw-r--r--roles/wg_portal/tasks/main.yml25
1 files changed, 7 insertions, 18 deletions
diff --git a/roles/wg_portal/tasks/main.yml b/roles/wg_portal/tasks/main.yml
index a7962919..78a235a1 100644
--- a/roles/wg_portal/tasks/main.yml
+++ b/roles/wg_portal/tasks/main.yml
@@ -94,28 +94,17 @@
state: "started"
enabled: true
-- name: "Create wg-portal nginx configurations"
+- name: "Create wg-portal nginx vhost configuration"
become: true
- when: wg_portal_by_nginx is defined and wg_portal_by_nginx | bool
- ansible.builtin.copy:
- content: |
- location / {
- proxy_pass http://127.0.0.1:{{ wg_portal_port }}/;
- }
- location /api/connections {
- proxy_pass http://127.0.0.1:{{ wg_portal_port }}/api/connections;
- }
- location /api/status {
- proxy_pass http://127.0.0.1:{{ wg_portal_port }}/api/status;
- }
- dest: "/etc/nginx/conf.d/wg-portal.conf"
+ when: wg_portal_hostname | length > 0
+ ansible.builtin.template:
+ src: "wg_portal.nginx.conf.j2"
+ dest: "/etc/nginx/vhosts.d/wg-portal.conf"
owner: "root"
group: "root"
mode: "0644"
backup: true
- # workaround issue: https://github.com/ansible/ansible/issues/9112
- # ref: https://serverfault.com/a/811520
validate: >
- bash -c 'echo "events { worker_connections 2; } http { server { include %s; } }" > /tmp/nginx.conf;
- sudo nginx -T -c /tmp/nginx.conf; ec=$?; rm -f /tmp/nginx.conf; exit $ec'
+ bash -c 'echo "events { worker_connections 64; } http { include %s; }" > /tmp/nginx-vhost.conf;
+ sudo nginx -T -c /tmp/nginx-vhost.conf; ec=$?; rm -f /tmp/nginx-vhost.conf; exit $ec'
notify: "Restart nginx"