Merge "Switch bifrost to use the dnsmasq DHCP driver"

changes/47/849247/5
Zuul 3 months ago committed by Gerrit Code Review
commit 243fb1dd97

@ -67,6 +67,29 @@ The IP address and network interface information which will be used by bare
metal machines to connect to the conductor and the internal HTTP server,
and for cross-service interactions.
dhcp_provider: "dnsmasq"
Which ironc DHCP provider to enable. When set to "none" a static dnsmasq
configuration is used, and host specific DHCP configuration can be set by
writing files to dhcp-hostsdir ``dnsmasq_dhcp_hostsdir`` and dhcp-optsdir
``dnsmasq_dhcp_optsdir``.
When set to "dnsmasq" Ironic will manage dhcp-option and dhcp-boot entries on a
per-node basis by writing files to ``dnsmasq_dhcp_hostsdir`` and
``dnsmasq_dhcp_optsdir``.
dnsmasq_dhcp_hostsdir: "/etc/dnsmasq.d/bifrost.dhcp-hosts.d"
Directory with static and ironic managed DHCP hosts configuration.
dnsmasq_dhcp_optsdir: "/etc/dnsmasq.d/bifrost.dhcp-opts.d"
Directory with ironic managed DHCP options configuration.
dnsmasq_leases_file: "/var/lib/dnsmasq/dnsmasq.leases"
File which represents dnsmasq leases, used when dhcp_provider == "dnsmasq"
enable_dhcp: false
If you chose to utilize the dhcp server, You may wish to set default ranges:

@ -168,6 +168,7 @@ enable_credential_less_deploy: false
# default: empty list
ironic_extra_packages: []
dhcp_provider: "dnsmasq"
# DHCP pool for requests -- ignored if inventory_dhcp is set to True
# since IP allocation will be static.
dhcp_pool_start: 192.168.1.200
@ -178,8 +179,12 @@ dhcp_static_mask: 255.255.255.0
# Whether to enable DNS in dnsmasq. Will conflict with any other DNS server,
# hence disabled by default.
dnsmasq_enable_dns: "{{ not (dnsmasq_disable_dns | default(True) | bool) }}"
# Directory with static DHCP hosts configuration.
# Directory with static and ironic managed DHCP hosts configuration.
dnsmasq_dhcp_hostsdir: "/etc/dnsmasq.d/bifrost.dhcp-hosts.d"
# Directory with ironic managed DHCP options configuration.
dnsmasq_dhcp_optsdir: "/etc/dnsmasq.d/bifrost.dhcp-opts.d"
# File which represents dnsmasq leases, used when dhcp_provider == "dnsmasq"
dnsmasq_leases_file: "/var/lib/dnsmasq/dnsmasq.leases"
# Uncomment to set up directory with additional hosts for DNS. Useless without
# dnsmasq_enable_dns set to True.
#dnsmasq_additional_hostsdir: "/etc/dnsmasq.d/bifrost.hosts.d"

@ -297,13 +297,21 @@
mode: 0755
when: dnsmasq_additional_hostsdir is defined
- name: "Setup inventory DHCP hosts directory"
- name: "Setup inventory DHCP and ironic managed hosts directory"
file:
path: "{{ dnsmasq_dhcp_hostsdir }}"
state: directory
owner: "dnsmasq"
group: "ironic"
mode: 0755
mode: 0775
- name: "Setup ironic managed DHCP options directory"
file:
path: "{{ dnsmasq_dhcp_optsdir }}"
state: directory
owner: "dnsmasq"
group: "ironic"
mode: 0775
- name: "Retrieve interface IP informations"
set_fact:

@ -87,13 +87,16 @@ dhcp-option=6,{{dnsmasq_dns_servers}}
dhcp-option=42,{{dnsmasq_ntp_servers}}
{% endif %}
dhcp-match=set:ipxe,175 # iPXE sends a 175 option.
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
dhcp-match=set:ipxe,175 # iPXE sends a 175 option.
{% if enable_uefi_ipxe | bool == true %}
dhcp-match=set:efi,option:client-arch,7
dhcp-match=set:efi,option:client-arch,9
@ -110,6 +113,7 @@ dhcp-boot=tag:ipxe,http://{{ internal_ip }}:{{ file_url_port }}/boot.ipxe
# Catch-all boot options used when no other boot options are matched.
dhcp-boot=/undionly.kpxe
{% endif %}
{% if testing | bool == true %}
log-queries

@ -3,7 +3,7 @@
[DEFAULT]
debug = {{ ironic_debug | bool }}
# NOTE(TheJulia): Until Bifrost supports neutron or some other network
# configuration besides a flat network where bifrost orchustrates the
# configuration besides a flat network where bifrost orchestrates the
# control instead of ironic, noop is the only available network driver.
enabled_network_interfaces = noop
default_deploy_interface = {{ default_deploy_interface }}
@ -121,7 +121,14 @@ send_sensor_data_interval = {{ sensor_data_interval }}
connection = mysql+pymysql://{{ ironic.database.username }}:{{ ironic.database.password }}@{{ ironic.database.host }}/{{ ironic.database.name }}?charset=utf8
[dhcp]
dhcp_provider = none
dhcp_provider = {{ dhcp_provider }}
{% if dhcp_provider == 'dnsmasq' %}
[dnsmasq]
dhcp_hostsdir = {{ dnsmasq_dhcp_hostsdir }}
dhcp_optsdir = {{ dnsmasq_dhcp_optsdir }}
leases_file = {{ dnsmasq_leases_file }}
{% endif %}
{% if enable_cors | bool == true %}
[cors]

@ -94,6 +94,7 @@ if [ ${USE_DHCP} = "true" ]; then
INVENTORY_DHCP=true
INVENTORY_DHCP_STATIC_IP=true
WRITE_INTERFACES_FILE=false
CLOUD_CONFIG+=" -e dhcp_provider=none"
elif [ ${BUILD_IMAGE} = "true" ]; then
USE_CIRROS=false
TESTING_USER=root

Loading…
Cancel
Save