From df3b4dc9c3aa91eeff178db5dbb58059f508c6ff Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Mon, 6 Oct 2025 16:16:12 +0200 Subject: [PATCH 1/2] dnsmasq: increase maximum allowed number of leases --- roles/dnsmasq/templates/00-options.conf.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/dnsmasq/templates/00-options.conf.j2 b/roles/dnsmasq/templates/00-options.conf.j2 index 0bcaa7f..00b3418 100644 --- a/roles/dnsmasq/templates/00-options.conf.j2 +++ b/roles/dnsmasq/templates/00-options.conf.j2 @@ -12,6 +12,9 @@ dhcp-proxy # has 3 s timeout during which no other requests are processed no-ping +# we have more than 1000 clients +dhcp-lease-max = 5000 + bind-interfaces interface = {{ interfaces | map(attribute='name') | join(',') }} From 450e4bb8f7485825f0984eb56c5585bb1760e0ef Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Mon, 6 Oct 2025 17:42:49 +0200 Subject: [PATCH 2/2] facts: look up device/VM services Not returned by default since NetBox 4.3. --- roles/facts/tasks/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/roles/facts/tasks/main.yml b/roles/facts/tasks/main.yml index dae7590..bf6e0e3 100644 --- a/roles/facts/tasks/main.yml +++ b/roles/facts/tasks/main.yml @@ -38,6 +38,18 @@ prefixes: '{{ query("netbox.netbox.nb_lookup", "prefixes", raw_data=true) | sort(attribute="prefix") | sort(attribute="family.value") }}' + # can only get NetBox ID for device/VM from (any) interface + # probably safe to assume at least one interface + - name: Get my ID + set_fact: + id: '{{ interfaces | map(attribute=("virtual_machine.id" if is_virtual else "device.id")) | first }}' + + - name: Get my services + set_fact: + services: '{{ + query("netbox.netbox.nb_lookup", "services", raw_data=true, + api_filter=("virtual_machine_id" if is_virtual else "device_id")+"="+id) }}' + - when: 'cluster is defined and not is_virtual' block: - name: Get my cluster and all nodes in it