bifrost/playbooks/roles/bifrost-ironic-install/templates/dnsmasq.conf.j2

128 lines
4.3 KiB
Django/Jinja

# Configuration file for dnsmasq.
#
# Format is one option per line, legal options are the same
# as the long options legal on the command line. See
# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.
# Listen on this specific port instead of the standard DNS port
# (53). Setting this to zero completely disables DNS function,
# leaving only DHCP and/or TFTP.
{% if dnsmasq_enable_dns | bool == true %}
port=53
{% else %}
port=0
{% endif %}
listen-address={{ internal_ip }}
# On systems which support it, dnsmasq binds the wildcard address,
# even when it is listening on only some interfaces. It then discards
# requests that it shouldn't reply to. This has the advantage of
# working even when interfaces come and go and change address. If you
# want dnsmasq to really bind only the interfaces it is listening on,
# uncomment this option. About the only time you may need this is when
# running another nameserver on the same machine.
bind-interfaces
# Include another lot of configuration options.
#conf-file=/etc/dnsmasq.more.conf
conf-dir=/etc/dnsmasq.d
# If you don't want dnsmasq to read /etc/hosts, uncomment the
# following line.
#no-hosts
# or if you want it to read another file, as well as /etc/hosts, use
# this.
#addn-hosts=/etc/banner_add_hosts
{% if dnsmasq_additional_hostsdir is defined %}
addn-hosts={{ dhcp_additional_hostsdir }}
{% endif %}
dhcp-hostsdir={{ dnsmasq_dhcp_hostsdir }}
{% if inventory_dhcp | bool == true %}
dhcp-ignore=tag:!known
{% endif %}
# Set the domain for dnsmasq. this is optional, but if it is set, it
# does the following things.
# 1) Allows DHCP hosts to have fully qualified domain names, as long
# as the domain part matches this setting.
# 2) Sets the "domain" DHCP option thereby potentially setting the
# domain of all systems configured by DHCP
# 3) Provides the domain part for "expand-hosts"
#domain=thekelleys.org.uk
{% if domain is defined %}
domain={{ domain }}
{% endif %}
# Uncomment this to enable the integrated DHCP server, you need
# to supply the range of addresses available for lease and optionally
# a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP
# service.
{% if testing | bool == true %}
dhcp-range=192.168.122.2,192.168.122.254,12h
{% elif inventory_dhcp | bool == true %}
dhcp-range={{dhcp_pool_start}},static,{{dhcp_static_mask}},{{dhcp_lease_time}}
{% else %}
dhcp-range={{dhcp_pool_start}},{{dhcp_pool_end}},{% if dhcp_pool_mask is defined %}{{dhcp_pool_mask}},{% endif %}{{dhcp_lease_time}}
{% endif %}
# Override the default route supplied by dnsmasq, which assumes the
# router is the same machine as the one running dnsmasq.
{% if not (dnsmasq_router | default(True) | bool) %}
{% if dnsmasq_router | ipaddr %}
dhcp-option=3,{{dnsmasq_router}}
{% else %}
dhcp-option=3
{% endif %}
{% endif %}
{% if dnsmasq_dns_servers is defined %}
dhcp-option=6,{{dnsmasq_dns_servers}}
{% endif %}
{% if dnsmasq_ntp_servers is defined %}
dhcp-option=42,{{dnsmasq_ntp_servers}}
{% endif %}
dhcp-match=set:ipxe,175 # iPXE sends a 175 option.
dhcp-match=set:efi,option:client-arch,7
dhcp-match=set:efi,option:client-arch,9
dhcp-match=set:efi,option:client-arch,11
dhcp-optsdir={{ dnsmasq_dhcp_optsdir }}
{% if dhcp_provider == 'none' %}
# Boot for Etherboot gPXE. The idea is to send two different
# filenames, the first loads gPXE, and the second tells gPXE what to
# load. The dhcp-match sets the gpxe tag for requests from gPXE.
dhcp-userclass=set:gpxe,"gPXE"
dhcp-boot=tag:gpxe,/ipxe.pxe
{% if default_boot_interface is defined and default_boot_interface == 'pxe' %}
# Client is PXE booting over EFI, boot with the grub shim
dhcp-boot=tag:efi,/bootx64.efi
{% elif 'ipxe' in enabled_boot_interfaces.split(',') %}
# Client is PXE booting over EFI without iPXE ROM; send EFI version of iPXE chainloader
dhcp-boot=tag:efi,tag:!ipxe,/{{ ipxe_efi_binary }}
{% endif %}
{% if testing | bool == true %}
dhcp-boot=tag:ipxe,http://192.168.122.1:{{ file_url_port }}/boot.ipxe
{% else %}
dhcp-boot=tag:ipxe,http://{{ internal_ip }}:{{ file_url_port }}/boot.ipxe
{% endif %}
# Catch-all boot options used when no other boot options are matched.
dhcp-boot=/undionly.kpxe
{% endif %}
{% if testing | bool == true %}
log-queries
log-dhcp
{% endif %}
enable-tftp
tftp-root={{ tftp_boot_folder }}