summaryrefslogtreecommitdiffstats
path: root/roles/pihole
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-09-02 04:38:23 +0200
committerAhmed Abdelhalim <[email protected]>2025-09-02 04:51:13 +0200
commita61e33c2ce6f138536492e006de7faf76662916a (patch)
tree99ee4b5f7f962e4fa16ed19556cd0d83b31a8ca8 /roles/pihole
parentac410cee8f7ca8d199f61f92788e99867865b36e (diff)
Configure dhcp hosts in pihole role
Diffstat (limited to 'roles/pihole')
-rw-r--r--roles/pihole/defaults/main.yml1
-rw-r--r--roles/pihole/meta/argument_specs.yml5
-rw-r--r--roles/pihole/templates/pihole.toml.j21
3 files changed, 7 insertions, 0 deletions
diff --git a/roles/pihole/defaults/main.yml b/roles/pihole/defaults/main.yml
index 7be113a4..1abac8e9 100644
--- a/roles/pihole/defaults/main.yml
+++ b/roles/pihole/defaults/main.yml
@@ -16,4 +16,5 @@ pihole_dhcp_end: "{{ ansible_default_ipv4.network | regex_replace('\\.0$', '.199
pihole_dhcp_router: "{{ ansible_default_ipv4.address }}"
pihole_dhcp_lease_time: 24
pihole_dhcp_domain: "local"
+pihole_dhcp_hosts: []
pihole_domain: ""
diff --git a/roles/pihole/meta/argument_specs.yml b/roles/pihole/meta/argument_specs.yml
index 9af61251..825d82d7 100644
--- a/roles/pihole/meta/argument_specs.yml
+++ b/roles/pihole/meta/argument_specs.yml
@@ -53,6 +53,11 @@ argument_specs:
type: "str"
description: "The dhcp local domain extension"
default: "local"
+ pihole_dhcp_hosts:
+ type: "list"
+ description: "The list of static DHCP host reservations (format: MAC,IP,hostname)"
+ elements: "str"
+ default: []
pihole_domain:
type: "str"
description: "The domain name to be configured when the pi is exposed over the internet"
diff --git a/roles/pihole/templates/pihole.toml.j2 b/roles/pihole/templates/pihole.toml.j2
index 67913821..8fc5571d 100644
--- a/roles/pihole/templates/pihole.toml.j2
+++ b/roles/pihole/templates/pihole.toml.j2
@@ -53,6 +53,7 @@ end = "{{ pihole_dhcp_end }}"
router = "{{ pihole_dhcp_router }}"
leaseTime = {{ pihole_dhcp_lease_time }}
domain = "{{ pihole_dhcp_domain }}"
+hosts = {{ pihole_dhcp_hosts | to_nice_json }}
{% endif %}
[webserver]