kolla-ansible/ansible/roles/ironic/templates/ironic-dnsmasq.conf.j2
Maksim Malchuk 762aecbfae Multiple DHCP ranges for Ironic Inspector
Add a new parameter 'ironic_dnsmasq_dhcp_ranges' and enable the
configuration of the corresponding 'dhcp-range' and 'dhcp-option'
blocks in Ironic Inspector dnsmasq for multiple ranges.

The old parameters 'ironic_dnsmasq_dhcp_range' and
'ironic_dnsmasq_default_gateway' used for the only range are now
removed.

This change implements the same solution used in the TripleO several
years ago in the: Ie49b07ffe948576f5d9330cf11ee014aef4b282d

Also, this change contains: Iae15e9db0acc2ecd5b087a9ca430be948bc3e649
fix for lease time.
The value can be changed globally or per range.

Change-Id: Ib69fc0017b3bfbc8da4dfd4301710fbf88be661a
Signed-off-by: Maksim Malchuk <maksim.malchuk@gmail.com>
Co-Authored-By: Radosław Piliszek <radoslaw.piliszek@gmail.com>
2022-04-13 19:26:31 +00:00

47 lines
1.6 KiB
Django/Jinja

# NOTE(yoctozepto): ironic-dnsmasq is used to deliver DHCP(v6) service
# DNS service is disabled:
port=0
interface={{ ironic_dnsmasq_interface }}
bind-interfaces
{% for item in ironic_dnsmasq_dhcp_ranges %}
{% set tag = item.tag | default('range_' ~ loop.index) %}
{% set lease_time = item.lease_time | default(ironic_dnsmasq_dhcp_default_lease_time) %}
dhcp-range=set:{{ tag }},{{ item.range }},{{ lease_time }}
{% if item.routers is defined %}
dhcp-option=tag:{{ tag }},option:router,{{ item.routers }}
{% endif %}
{% endfor %}
dhcp-sequential-ip
{% if api_address_family == 'ipv6' %}
{# TODO(yoctozepto): IPv6-only support - DHCPv6 PXE support #}
{# different options must be used here #}
{% else %}{# ipv4 #}
dhcp-option=option:tftp-server,{{ api_interface_address }}
dhcp-option=option:server-ip-address,{{ api_interface_address }}
dhcp-option=210,/var/lib/ironic/tftpboot/
{% if ironic_dnsmasq_serve_ipxe | bool %}
dhcp-match=ipxe,175
dhcp-match=set:efi,option:client-arch,7
dhcp-match=set:efi,option:client-arch,9
# Client is already running iPXE; move to next stage of chainloading
dhcp-option=tag:ipxe,option:bootfile-name,{{ ironic_http_url }}/inspector.ipxe
# Client is PXE booting over EFI without iPXE ROM,
# send EFI version of iPXE chainloader
dhcp-option=tag:efi,tag:!ipxe,option:bootfile-name,{{ ironic_dnsmasq_uefi_ipxe_boot_file }}
{% endif %}
dhcp-option=option:bootfile-name,{{ ironic_dnsmasq_boot_file }}
{% endif %}{# ipv6/ipv4 #}
log-async
log-facility=/var/log/kolla/ironic/dnsmasq.log
{% if ironic_logging_debug | bool %}
log-dhcp
{% endif %}
{% if ironic_inspector_pxe_filter == 'dnsmasq' %}
dhcp-hostsdir=/etc/dnsmasq/dhcp-hostsdir
{% endif %}