From 2bc8a280dd5abcdc4e5bcec167b64d9e27abcb9b Mon Sep 17 00:00:00 2001 From: Daniel Vijge Date: Tue, 23 Jul 2024 19:54:31 +0200 Subject: [PATCH] Option to set specific DNS servers for hosts --- config/dhcp | 3 +++ config/dnsmasq.conf | 9 +++++++++ inventory-sample.yaml | 10 ++++++++++ 3 files changed, 22 insertions(+) diff --git a/config/dhcp b/config/dhcp index 90172f6..fc0b9b1 100644 --- a/config/dhcp +++ b/config/dhcp @@ -16,6 +16,9 @@ config dnsmasq list rebind_domain '{{ domain }}' {% endfor %} {% endif %} +{% if dhcp is defined and dhcp.tags is defined %} + option strictorder '1' +{% endif %} {% for _, network in networks.items() %} {% if _ not in ('wan','additional') %} diff --git a/config/dnsmasq.conf b/config/dnsmasq.conf index 35a847d..5893118 100644 --- a/config/dnsmasq.conf +++ b/config/dnsmasq.conf @@ -58,3 +58,12 @@ address=/dualstack.apiproxy-website-nlb-prod-2-b4de62b516adfbbf.elb.eu-west-1.am server=/dualstack.apiproxy-website-nlb-prod-1-5675d5ecda6efdd8.elb.eu-west-1.amazonaws.com/# address=/dualstack.apiproxy-website-nlb-prod-1-5675d5ecda6efdd8.elb.eu-west-1.amazonaws.com/:: {% endif %} + +{% if dhcp.tags is defined %} +{% for tag in dhcp.tags %} +{% for host in tag.hosts %} +dhcp-host={{ host }},set:{{ tag.tag }} +{% endfor %} +dhcp-option=tag:{{ tag.tag }},option:dns-server,{{ tag.server | join(',') }} +{% endfor %} +{% endif %} diff --git a/inventory-sample.yaml b/inventory-sample.yaml index 7cb2c76..85f1331 100644 --- a/inventory-sample.yaml +++ b/inventory-sample.yaml @@ -259,3 +259,13 @@ openwrt: # retrieved. upnp: configure_with_external_ip: false + dhcp: + domain_whitelist: + - plex.direct + tags: + - tag: CloudFlareFamily + server: + - 1.1.1.3 + - 1.0.0.3 + hosts: + - DD:45:4F:4A:2E:99