From c9674b656ee1c274860fdc2497e0dd0a6182fa95 Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Tue, 1 Nov 2022 16:37:27 +0000 Subject: [PATCH] Allow ironic bmaas network gateway and dns servers to be undefined For a simple unrouted network these do not exist, but the role currently forces bogus values to be given for the dhcpd template. Allow the values to be unset to reduce confusion. Change-Id: I609a05c50d1de5668f2b092e3a3ef1015e944fe6 --- defaults/main.yml | 2 ++ templates/dhcpd.conf.j2 | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 69dd410f..abf187ff 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -383,7 +383,9 @@ ironic_inspector_dhcp_address: "{{ ironic_bmaas_address }}" ironic_inspector_dhcp_pool_range: 192.168.0.51 192.168.0.150 ironic_inspector_dhcp_subnet: 192.168.0.0/22 ironic_inspector_dhcp_subnet_mask: 255.255.252.0 +ironic_insepctor_dhcp_enable_gateway: True ironic_inspector_dhcp_gateway: 192.168.0.1 +ironic_inspector_dhcp_enable_nameservers: True ironic_inspector_dhcp_nameservers: 192.168.0.1 ironic_inspector_dhcp_lease_time: 600 diff --git a/templates/dhcpd.conf.j2 b/templates/dhcpd.conf.j2 index ed9de9bc..d76af416 100644 --- a/templates/dhcpd.conf.j2 +++ b/templates/dhcpd.conf.j2 @@ -11,8 +11,12 @@ set pxetype = option pxe-system-type; subnet {{ ironic_inspector_dhcp_subnet }} netmask {{ ironic_inspector_dhcp_subnet_mask }} { +{% if ironic_inspector_enable_dhcp_gateway | bool %} option routers {{ ironic_inspector_dhcp_gateway }}; +{% endif %} +{% if ironic_inspector_enable_dhcp_nameservers | bool %} option domain-name-servers {{ ironic_inspector_dhcp_nameservers}}; +{% endif %} option subnet-mask {{ ironic_inspector_dhcp_subnet_mask }}; range dynamic-bootp {{ ironic_inspector_dhcp_pool_range }}; default-lease-time {{ ironic_inspector_dhcp_lease_time }};