Merge "Make DHCP inventory handling more flexible"

This commit is contained in:
Zuul 2021-03-01 16:58:20 +00:00 committed by Gerrit Code Review
commit 2afd647ceb
4 changed files with 41 additions and 12 deletions

View File

@ -125,7 +125,6 @@ ipa_builder_git_url: https://opendev.org/openstack/ironic-python-agent-builder
prometheus_exporter_git_url: https://opendev.org/openstack/ironic-prometheus-exporter
mysql_username: "root"
mysql_password: ""
disable_dnsmasq_dns: True
ironic_git_folder: /opt/stack/ironic
ironicclient_git_folder: /opt/stack/python-ironicclient
openstacksdk_git_folder: /opt/stack/openstacksdk
@ -165,6 +164,16 @@ dhcp_pool_start: 192.168.1.200
dhcp_pool_end: 192.168.1.250
dhcp_lease_time: 12h
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.
dnsmasq_dhcp_hostsdir: "/etc/dnsmasq.d/bifrost.dhcp-hosts.d"
# 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"
# Dnsmasq default route for clients. If not defined, dnsmasq will push to clients
# as default route the same IP of the dnsmasq server.
# If set to false, it will disable default route creation in clients.

View File

@ -242,22 +242,23 @@
- name: "Create an ESP image"
import_tasks: create_esp.yml
- name: "Setup Inventory Hosts Directory"
- name: "Setup additional DHCP hosts directory"
file:
path: "/etc/dnsmasq.d/bifrost.hosts.d"
path: "{{ dnsmasq_additional_hostsdir }}"
state: directory
owner: "root"
group: "root"
mode: 0755
when: inventory_dhcp | bool
- name: "Setup Inventory DHCP Hosts Directory"
when: dnsmasq_additional_hostsdir is defined
- name: "Setup inventory DHCP hosts directory"
file:
path: "/etc/dnsmasq.d/bifrost.dhcp-hosts.d"
path: "{{ dnsmasq_dhcp_hostsdir }}"
state: directory
owner: "root"
group: "root"
mode: 0755
when: inventory_dhcp | bool
- name: "Retrieve interface IP informations"
set_fact:
itf_infos: "{{ internal_interface }}"

View File

@ -7,10 +7,10 @@
# 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 disable_dnsmasq_dns | bool == true %}
port=0
{% else %}
{% if dnsmasq_enable_dns | bool == true %}
port=53
{% else %}
port=0
{% endif %}
listen-address={{ internal_ip }}
@ -34,9 +34,13 @@ conf-dir=/etc/dnsmasq.d
# 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 %}
addn-hosts=/etc/dnsmasq.d/bifrost.hosts.d
dhcp-hostsfile=/etc/dnsmasq.d/bifrost.dhcp-hosts.d
dhcp-ignore=tag:!known
{% endif %}

View File

@ -0,0 +1,15 @@
---
features:
- |
The dynamic DHCP inventory hostsdir is now created and enabled by default,
even when ``inventory_dhcp`` is ``false``.
upgrade:
- |
An additional DNS hosts directory is no longer created by default in
``/etc/dnsmasq.d/bifrost.hosts.d`` when ``inventory_dhcp`` is ``true``.
Set the new variable ``dnsmasq_additional_hostsdir`` to keep the previous
behavior (you'll need ``dnsmasq_enable_dns=true`` to actually use it).
deprecations:
- |
The parameter ``disable_dnsmasq_dns`` has been deprecated in favor of
the new parameter ``dnsmasq_enable_dns``.