Files
ansible-matzman-test/roles/docker-pihole/templates/docker-compose.j2
T
2026-03-24 08:19:29 +01:00

45 lines
1.3 KiB
Django/Jinja

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
{{ app_name }}:
container_name: {{ app_name }}
image: {{ pihole_image_name }}
ports:
# DNS Ports
- "{{ host_ip_addr | ansible.utils.ipaddr }}:53:53/tcp"
- "{{ host_ip_addr | ansible.utils.ipaddr }}:53:53/udp"
{% if app_proxy_network is none %}
- "{{ host_ip_addr | ansible.utils.ipaddr }}:83:80/tcp"
{% endif %}
networks:
{% if app_proxy_network is not none %}
{{ app_proxy_network }}:
{% else %}
{{ app_name ~ "-net" }}:
{% endif %}
environment:
TZ: '{{ pihole_timezone }}'
FTLCONF_webserver_api_password: '{{ pihole_webapi_password }}'
volumes:
- './{{ pihole_etc_dir }}:/etc/pihole'
cap_add:
- CAP_SYS_NICE
restart: unless-stopped
{% if app_proxy_network is not none %}
labels:
traefik.enable: true
traefik.docker.network: "{{ app_proxy_network }}"
traefik.http.routers.{{ app_name }}-http.rule: "Host(`{{ app_base_domain }}`)"
traefik.http.routers.{{ app_name }}-http.entryPoints: web
traefik.http.services.{{ app_name }}.loadbalancer.server.port: 80
{% endif %}
networks:
{% if app_proxy_network is not none %}
{{ app_proxy_network }}:
external: true
{% else %}
{{ app_name ~ "-net" }}:
{% endif %}