--- # SPDX-License-Identifier: GPL-3.0-only AND EUPL-1.2 # Derived from https://codeberg.org/ansible/pihole by Taha Ahmed (solarchemist), # modified by Defame1297. The option comments came in via that upstream from # Pi-hole FTL v6.2.2/v6.2.3 (Copyright Pi-hole, LLC, EUPL-1.2); see NOTICE. pihole_default: repo: remote: "https://github.com/pi-hole/pi-hole.git" # use "version: latest" to get the latest *release*, or specify a version # to install, e.g., "version: 'v6.1.4'" version: "v6.4" # I don't like using /tmp because it requires running git as root # most suitable "tmp"-like path under user's HOME is ~/.cache/ I guess path: "{{ ansible_env.HOME }}/.cache/pi-hole" gh_slug: "pi-hole/pi-hole" user: pihole group: pihole # configure /etc/pihole/pihole.toml # I chose to configure it this way because neither lineinfile nor blockinfile modules # are suitable for handling TOML files # https://stackoverflow.com/questions/79673679/ansible-lineinfile-and-replace-modules-attempting-to-configure-toml-txt-file config: dns: # array of IP addresses and/or hostnames, optionally with a port (#...) # dns_servers: upstreams: - "1.1.1.1" - "8.8.8.8" # Use this option to control deep CNAME inspection. Disabling it might be beneficial # for very low-end devices CNAMEdeepInspect: true blockESNI: true EDNS0ECS: true # Should FTL hide queries made by localhost? ignoreLocalhost: false # Should FTL analyze and show internally generated DNSSEC queries? showDNSSEC: true # Should FTL analyze *only* A and AAAA queries? analyzeOnlyAandAAAA: false # Changing this setting causes FTL to restart. # Possible values are "NONE", "HOSTNAME", "HOSTNAMEFQDN", or "PI.HOLE" piholePTR: "PI.HOLE" # How should FTL handle queries when the gravity database is not available? # Possible values are: "BLOCK", "ALLOW", "REFUSE", "DROP" replyWhenBusy: "DROP" blockTTL: 2 # List of custom DNS records hosts: [] # If set, A and AAAA queries for plain names, without dots or domain parts, are never # forwarded to upstream nameservers # Is true a better default (for Unbound)? # https://github.com/community-scripts/ProxmoxVE/discussions/2508 domainNeeded: false # If set, the domain is added to simple names (without a period) in /etc/hosts in the # same way as for DHCP-derived names # Is true a better default (for Unbound)? # https://github.com/community-scripts/ProxmoxVE/discussions/2508 expandHosts: false # The DNS domain used by your Pi-hole. # You can disable setting a domain by setting this option to an empty string. domain: "lan" # Should all reverse lookups for private IP ranges (i.e., 192.168.x.y, etc) which are # not found in /etc/hosts or the DHCP leases file be answered with "no such domain" # rather than being forwarded upstream? bogusPriv: true # Validate DNS replies using DNSSEC? dnssec: false # Interface to use for DNS (see also dnsmasq.listening.mode) and DHCP (if enabled) # Host-specific: empty placeholder, the role fails until it is set through # pihole_overrides (see tasks/validate.yml). interface: "" # Add A, AAAA and PTR records to the DNS. hostRecord: "" # Pi-hole interface listening modes # Possible values are: LOCAL, SINGLE, BIND, ALL, NONE listeningMode: "LOCAL" # Log DNS queries and replies to pihole.log queryLogging: true cnameRecords: [] # Port used by the DNS server port: 53 # Reverse server (former also called "conditional forwarding") feature # Array of reverse servers each one in one of the following forms: # ",[/],[#][,]" revServers: [] # [dns.cache] cache: # Cache size of the DNS server. Note that expiring cache entries naturally make room # for new insertions over time. Setting this number too high will have an adverse # effect as not only more space is needed, but also lookup speed gets degraded in the # 10,000+ range. dnsmasq may issue a warning when you go beyond 10,000+ cache entries. size: 10000 # Query cache optimizer: If a DNS name exists in the cache, but its time-to-live has # expired only recently, the data will be used anyway (a refreshing from upstream is # triggered). This can improve DNS query delays especially over unreliable Internet # connections. optimizer: 3600 # This setting allows you to specify the TTL used for queries blocked upstream. Once # the TTL expires, the query will be forwarded to the upstream server again to check # if the block is still valid. Defaults to caching for one day (86400 seconds). upstreamBlockedTTL: 86400 # [dns.blocking] blocking: # Should FTL block queries? active: true # How should FTL reply to blocked queries? # Possible values are: NULL, IP_NODATA_AAAA, IP, NX, NODATA mode: "NULL" # Should FTL enrich blocked replies with EDNS0 information? # Possible values are: "NONE", "CODE", "TEXT" edns: "TEXT" # [dns.specialDomains] specialDomains: # Should Pi-hole always reply with NXDOMAIN to A and AAAA queries of # use-application-dns.net to disable Firefox automatic DNS-over-HTTP? mozillaCanary: true # Should Pi-hole always reply with NXDOMAIN to A and AAAA queries of mask.icloud.com # and mask-h2.icloud.com to disable Apple's iCloud Private Relay to prevent Apple # devices from bypassing Pi-hole? iCloudPrivateRelay: true # Should Pi-hole always reply with NODATA to all queries to zone resolver.arpa to # prevent devices from bypassing Pi-hole using Discovery of Designated Resolvers? designatedResolver: true reply: # [dns.reply.host] host: # Use a specific IPv4 address for the Pi-hole host? force4: false # Custom IPv4 address for the Pi-hole host IPv4: "" # Use a specific IPv6 address for the Pi-hole host? force6: false # Custom IPv6 address for the Pi-hole host IPv6: "" # [dns.reply.blocking] blocking: # Use a specific IPv4 address in IP blocking mode? force4: false # Custom IPv4 address for IP blocking mode IPv4: "" # Use a specific IPv6 address in IP blocking mode? force6: false # Custom IPv6 address for IP blocking mode IPv6: "" # [dns.rateLimit] rateLimit: # Rate-limited queries are answered with a REFUSED reply and not further processed by FTL. count: 1000 # ... in the set interval before rate-limiting? interval: 60 # [dhcp] dhcp: # Is the embedded DHCP server enabled? active: false # Start address of the DHCP address pool start: "" # End address of the DHCP address pool end: "" # Address of the gateway to be used (typically the address of your router) router: "" # The netmask used by your Pi-hole. netmask: "" # If the lease time is given, then leases will be given for that length of time. leaseTime: "" # Should Pi-hole make an attempt to also satisfy IPv6 address requests ipv6: false # Enable DHCPv4 Rapid Commit Option specified in RFC 4039. rapidCommit: false # Advertise DNS server multiple times to clients. multiDNS: false # Enable logging for DHCP. logging: false # Ignore unknown DHCP clients. ignoreUnknownClients: false # Per host parameters for the DHCP server. hosts: [] ntp: # [ntp.ipv4] ipv4: # Should FTL act as network time protocol (NTP) server (IPv4)? active: false # IPv4 address to listen on for NTP requests address: "" # [ntp.ipv6] ipv6: # Should FTL act as network time protocol (NTP) server (IPv6)? active: false address: "" # [ntp.sync] sync: # Should FTL try to synchronize the system time with an upstream NTP server? active: false # NTP upstream server to sync with, e.g., "pool.ntp.org". Note that the NTP server # should be located as close as possible to you in order to minimize the time offset # possibly introduced by different routing paths. # http://www.svl2.ntp.se # https://www.cyberinfo.se/arkiv/tidssynkronisering-med-ntp # server: "se.pool.ntp.org" server: "sth2.ntp.se" # Interval in seconds between successive synchronization attempts with the NTP server interval: 3600 # Number of NTP syncs to perform and average before updating the system time count: 8 # [ntp.sync.rtc] rtc: # Should FTL update a real-time clock (RTC) if available? set: false # Path to the RTC device to update. Leave empty for auto-discovery device: "" # Should the RTC be set to UTC? utc: true # [resolver] resolver: # Should FTL try to resolve IPv4 addresses to hostnames? resolveIPv4: true # Should FTL try to resolve IPv6 addresses to hostnames? resolveIPv6: true # Control whether FTL should use the fallback option to try to obtain client names from # checking the network table. This behavior can be disabled with this option. networkNames: true # With this option, you can change how (and if) hourly PTR requests are made to check # for changes in client and upstream server hostnames. # Possible values are: "IPV4_ONLY", "ALL", "UNKNOWN", "NONE" refreshNames: "IPV4_ONLY" # [database] database: # Should FTL load information from the database on startup to be aware of the most # recent history? DBimport: true # How long should queries be stored in the database [days]? # Setting this value to 0 will disable the database. maxDBdays: 91 # How often do we store queries in FTL's database [seconds]? DBinterval: 60 # Should FTL enable Write-Ahead Log (WAL) mode for the on-disk query database # (configured via files.database)? It is recommended to leave this setting enabled # for performance reasons. useWAL: true # [database.network] network: # Should FTL analyze the local ARP cache? When disabled, client identification and the # network table will stop working reliably. parseARPcache: true # How long should IP addresses be kept in the network_addresses table [days]? IP # addresses (and associated host names) older than the specified number of days are # removed to avoid dead entries in the network overview table. # looks like it should be set to the same value as database.maxDBdays expire: 91 # [webserver] webserver: # On which domain is the web interface served? domain: "pi.hole" # Webserver access control list (ACL) allowing for restrictions to be put on the list # of IP addresses which have access to the web server. acl: "" # Ports to be used by the webserver. Comma-separated list of ports to listen on. # I want to make it easier on myself so set to port 80 on all interfaces for both IPv4 and IPv6 # note that this is different from Pi-Hole's default "80o,443os,[::]:80o,[::]:443os" # port: "80,[::]:80" # this gives the lighttpd landing page and no Pi-Hole web UI # port: "80o,443os,[::]:80o,[::]:443os" # ditto # for some reason this works but not the variations above port: "8080o,8443os,[::]:8080o,[::]:8443os" # Maximum number of worker threads allowed. threads: 50 # Additional HTTP headers added to the web server responses. headers: - "X-DNS-Prefetch-Control: off" - "Content-Security-Policy: default-src 'self' 'unsafe-inline';" - "X-Frame-Options: DENY" - "X-XSS-Protection: 0" - "X-Content-Type-Options: nosniff" - "Referrer-Policy: strict-origin-when-cross-origin" # Should the web server serve all files in webserver.paths.webroot directory? serve_all: false # [webserver.session] session: # Session timeout in seconds. # This option may also be used to make logins persistent for long times. timeout: 1800 # Should Pi-hole backup and restore sessions from the database? restore: true # [webserver.tls] tls: # Path to the TLS (SSL) certificate file. cert: "/etc/pihole/tls.pem" # [webserver.paths] paths: # Server root on the host webroot: "/var/www/html" # Sub-directory of the root containing the web interface webhome: "/admin/" # Prefix where the web interface is served prefix: "" # [webserver.interface] interface: # Should the web interface use the boxed layout? boxed: true # Theme used by the Pi-hole web interface # Possible values are: "default-auto", "default-light", "default-dark", "default-darker", # "high-contrast", "high-contrast-dark", "lcars" (Star Trek LCARS) theme: "default-auto" # [webserver.api] api: # Number of concurrent sessions allowed for the API. max_sessions: 16 # Should FTL prettify the API output (add extra spaces, newlines and indentation)? prettyJSON: false # API password hash (you set password, hash is generated in Jinja template) password: "{{ pihole_web_password }}" # Pi-hole 2FA TOTP secret. totp_secret: "" # Pi-hole application password (to circumvent 2FA for legacy 3rd-party services) app_password: "" # Should application password API sessions be allowed to modify config settings? app_sudo: false # Should FTL create a temporary CLI password? This password is stored in clear in # /etc/pihole and can be used by the CLI (pihole ... commands) to authenticate # against the API. cli_pw: true # Array of clients to be excluded from certain API responses (regex), # e.g., the Top Clients or Query Log excludeClients: [] # Array of domains to be excluded from certain API responses (regex), # e.g., the Top Clients or Query Log excludeDomains: [] # How much history should be imported from the database and returned by the API # [seconds]? (max 24*60*60 = 86400) maxHistory: 86400 # Up to how many clients should be returned in the activity graph endpoint # (/api/history/clients)? # This setting can be overwritten at run-time using the parameter N. Setting this to 0 # will always send all clients. Be aware that this may be challenging for the GUI if # you have many (think > 1.000 clients) in your network maxClients: 0 # default 10 # How should the API compute the most active clients? client_history_global_max: true # Allow destructive API calls (e.g. restart DNS server, flush logs, ...) allow_destructive: true # [webserver.api.temp] temp: # Which upper temperature limit should be used by Pi-hole? limit: "60.000000" # Which temperature unit should be used for temperatures processed by FTL? unit: "C" # [files] files: # The file which contains the PID of FTL's main process. pid: "/run/pihole-FTL.pid" # The location of FTL's long-term database database: "/etc/pihole/pihole-FTL.db" # The location of Pi-hole's gravity database gravity: "/etc/pihole/gravity.db" # A temporary directory where Pi-hole can store files during gravity updates. gravity_tmp: "/tmp" # The database containing MAC -> Vendor information for the network table macvendor: "/etc/pihole/macvendor.db" # An optional file containing a pcap capture of the network traffic. pcap: "" # [files.log] log: # The location of FTL's log file ftl: "/var/log/pihole/FTL.log" # The log file used by the embedded dnsmasq DNS server dnsmasq: "/var/log/pihole/pihole.log" # The log file used by the webserver webserver: "/var/log/pihole/webserver.log" # [misc] misc: # Privacy levels in Pi-Hole statistics # Changing this setting will trigger a restart of FTL # - 0: don't hide anything # - 1: hide domains # - 2: hide domains and clients # - 3: anonymize everything privacylevel: 1 delay_startup: 0 # Set niceness of pihole-FTL. Defaults to -10 and can be disabled altogether by setting # a value of -999. nice: -10 addr2line: true # Should FTL load additional dnsmasq configuration files from /etc/dnsmasq.d/? etc_dnsmasq_d: false # Either enable misc.etc_dnsmasq_d to restore the "old" behaviour, or if # you have only a few lines you can add them directly to the misc.dnsmasq_lines # setting instead. https://discourse.pi-hole.net/t/v6-post-release-fixes-and-findings/76480 dnsmasq_lines: # maximum number of concurrent DNS queries, 150 by default # https://discourse.pi-hole.net/t/ resolved-maximum-number-of-concurrent-dns-queries-reached/60970 # https://discourse.pi-hole.net/t/maximum-number-of-concurrent-dns-queries-reached/51804 - "dns-forward-max=150" # Log additional information about queries and replies to pihole.log extraLogging: false # Put configuration into read-only mode. This will prevent any changes to the # configuration file via the API or CLI. This setting useful when a configuration is # to be forced/modified by some third-party application (like infrastructure-as-code # providers) and should not be changed by any means. # This setting is critical to allow this role to configure pihole.toml reliably # https://discourse.pi-hole.net/t/support-writing-to-pihole-toml-directly/70522 # default False readOnly: true # [misc.check] check: # Have FTL regularly check system load and warn about excessive load if # the 15 minute system load average exceeds the number of cores? load: true shmem: 90 # warn if disk usage exceeds this percentage (set to zero to disable) disk: 90 # [debug] debug: # Print debugging information about database actions. database: false # Prints a list of the detected interfaces on the startup of pihole-FTL. networking: false # Print information about shared memory locks. locks: false # Print extensive query information (domains, types, replies, etc.). queries: false # Print flags of queries received by the DNS hooks. Only effective when DEBUG_QUERIES # is enabled as well. flags: false # Print information about shared memory buffers. shmem: false # Print information about garbage collection gc: false # Print information about ARP table processing arp: false # Controls if FTLDNS should print extended details about regex matching into FTL.log. regex: false # Print extra debugging information concerning API calls. api: false # Print extra debugging information about TLS connections. tls: false # Print information about overTime memory operations, such as initializing or moving # overTime slots. overtime: false # Print information about status changes for individual queries. status: false # Print information about capabilities granted to the pihole-FTL process. caps: false # Print information about DNSSEC activity dnssec: false # FTL uses dynamically allocated vectors for various tasks. vectors: false # Extensive information about hostname resolution like which DNS servers are used in # the first and second hostname resolving tries (only affecting internally generated # PTR queries). resolver: false # Print debugging information about received EDNS(0) data. edns0: false # Log various important client events such as change of interface (e.g., client # switching from WiFi to wired or VPN connection), as well as extensive reporting # about how clients were assigned to its groups. clients: false # Log information related to alias-client processing. aliasclients: false # Log information regarding FTL's embedded event handling queue. events: false # Log information about script helpers, e.g., due to dhcp-script. helper: false # Print config parsing details config: false # Debug monitoring of /etc/pihole filesystem events inotify: false # Debug monitoring of the webserver (CivetWeb) events webserver: false # Temporary flag that may print additional information. extra: false # Reserved debug flag reserved: false # Print information about NTP synchronization ntp: false # Print information about netlink communication and parsing netlink: false # Set all debug flags at once. This is a convenience option to enable all debug flags # at once. Note that this option is not persistent, setting it to true will enable all # *remaining* debug flags but unsetting it will disable *all* debug flags. all: false # Merged recursively over pihole_default. config.dns.interface must be set here. pihole_overrides: {} # set pihole_testing to true to enable debug messages # easiest via --extra-vars "{pihole_testing: true}" # the web password, app password and TOTP secret are masked in that output pihole_testing: false pihole_testing_timeout: 5 # no effect: the install condition ends in "or true" pihole_force_install: false # path to Pi-Hole's automated install script # supports the "--unattended" flag # NOTE the inner quotes are important since path contains a space # Lazy: reads __pihole_effective.repo.path, which tasks/merge-defaults.yml sets in the role. pihole_install_script: "'{{ __pihole_effective.repo.path }}/automated install/basic-install.sh'" # available on Ubuntu noble and resolute pihole_apt_dependencies: - curl # command line tool for transferring data with URL syntax - git # fast, scalable, distributed revision control system - procps # /proc file system utilities - lighttpd-mod-deflate # fast webserver with minimal memory footprint - apt-utils # package management related utility programs - whiptail # Displays user-friendly dialog boxes from shell scripts # dropped because of incompatibility with RPi lightdm desktop environment # which should not affect Ubuntu, but since I have not tested that specifically # and since this package is not critical, safer to just drop it # - dhcpcd5 # DHCPv4, IPv6RA and DHCPv6 client with IPv4LL support - dnsutils # Transitional package for bind9-dnsutils - bc # GNU bc arbitrary precision calculator language - unzip # De-archiver for .zip files - wget # retrieves files from the web - sudo # Provide limited super user privileges to specific users - netcat-openbsd # TCP/IP swiss army knife - cron # process scheduling daemon - iproute2 # networking and traffic control tools