diff options
| author | Ahmed Abdelhalim <[email protected]> | 2026-06-17 18:37:49 +0200 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2026-06-17 18:42:02 +0200 |
| commit | c7a4dfce1ad0b545b05a8043e321ad49e48873a6 (patch) | |
| tree | fe8a0bfc1bc31dc93a8138cce179df2416875bf4 /roles/pihole/tasks | |
| parent | d9dcfdd822f90eb65117523d7c15694fae952bd2 (diff) | |
Refactor pi roles to use .home.arpa subdomains for services
Diffstat (limited to 'roles/pihole/tasks')
| -rw-r--r-- | roles/pihole/tasks/main.yml | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/roles/pihole/tasks/main.yml b/roles/pihole/tasks/main.yml index 52ccafcf..66208bdf 100644 --- a/roles/pihole/tasks/main.yml +++ b/roles/pihole/tasks/main.yml @@ -149,25 +149,17 @@ tags: - molecule-idempotence-notest -- name: "Create pihole nginx configurations" +- name: "Create pihole nginx vhost configuration" become: true - when: pihole_by_nginx is defined and pihole_by_nginx | bool - ansible.builtin.copy: - content: | - location /admin/ { - proxy_pass http://127.0.0.1:{{ pihole_port }}/admin/; - } - location /api/ { - proxy_pass http://127.0.0.1:{{ pihole_port }}/api/; - } - dest: "/etc/nginx/conf.d/pihole.conf" + when: pihole_hostname | length > 0 + ansible.builtin.template: + src: "pihole.nginx.conf.j2" + dest: "/etc/nginx/vhosts.d/pihole.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" |
