template.yaml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ---
  2. kind: compose
  3. schema: "1.1"
  4. metadata:
  5. name: Pihole
  6. description: >
  7. Network-wide advertisement and internet tracker blocking application that functions as a DNS blackhole.
  8. Provides DNS-level content filtering for all network devices, improving browsing performance, privacy, and security.
  9. Supports custom blocklists, whitelists, and seamless integration with existing network infrastructure.
  10. Project: https://pi-hole.net/
  11. Documentation: https://docs.pi-hole.net/
  12. GitHub: https://github.com/pi-hole/pi-hole
  13. version: 2025.10.2
  14. author: Christian Lempa
  15. date: '2025-10-28'
  16. tags:
  17. - dns
  18. - ad-blocking
  19. next_steps: |
  20. {% if swarm_enabled -%}
  21. 1. Deploy to Docker Swarm:
  22. docker stack deploy -c compose.yaml pihole
  23. 2. Access the Web Interface:
  24. {%- if traefik_enabled == True -%}https://{{ traefik_host }}/admin
  25. {%- else -%}https://<your-swarm-node-ip>:{{ ports_https }}/admin{%- endif %}
  26. 3. Configure devices to use swarm node IP as DNS
  27. {% else -%}
  28. 1. Deploy to Docker:
  29. docker compose up -d
  30. 2. Access the Web Interface:
  31. {%- if traefik_enabled == True -%}https://{{ traefik_host }}/admin
  32. {%- else -%}https://<your-docker-host-ip>:{{ ports_https }}/admin{%- endif %}
  33. 3. Configure devices to use docker host IP as DNS
  34. {% endif -%}
  35. spec:
  36. general:
  37. vars:
  38. service_name:
  39. default: "pihole"
  40. container_name:
  41. default: "pihole"
  42. admin_settings:
  43. description: "Admin Pi-hole Settings"
  44. required: true
  45. vars:
  46. webpassword:
  47. description: "Web interface admin password"
  48. type: str
  49. sensitive: true
  50. default: ""
  51. autogenerated: true
  52. traefik:
  53. vars:
  54. traefik_enabled:
  55. needs: "network_mode=bridge"
  56. traefik_host:
  57. default: "pihole.home.arpa"
  58. network:
  59. vars:
  60. network_mode:
  61. extra: >
  62. If you need DHCP functionality, use 'host' or 'macvlan' mode.
  63. NOTE: Swarm only supports 'bridge' mode!"
  64. network_name:
  65. default: "pihole_network"
  66. ports:
  67. vars:
  68. ports_http:
  69. description: "External HTTP port"
  70. type: int
  71. default: 8080
  72. needs: ["traefik_enabled=false", "network_mode=bridge"]
  73. ports_https:
  74. description: "External HTTPS port"
  75. type: int
  76. default: 8443
  77. needs: ["traefik_enabled=false", "network_mode=bridge"]
  78. ports_dns:
  79. description: "External DNS port"
  80. type: int
  81. default: 53
  82. needs: "network_mode=bridge"
  83. ports_ntp:
  84. description: "External NTP port"
  85. type: int
  86. default: 123
  87. needs: "network_mode=bridge"
  88. swarm:
  89. vars:
  90. swarm_enabled:
  91. needs: "network_mode=bridge"
  92. swarm_placement_host:
  93. required: true
  94. optional: false
  95. needs: null
  96. webpassword_secret_name:
  97. description: "Docker Swarm secret name for admin password"
  98. type: str
  99. default: "pihole_webpassword"