Make DHCP inventory handling more flexible
Configure a hostsdir even when inventory_dhcp is false, so that a deployment can use a mixed approach. Stop creating an unused additional DNS hostsdir by default since we disable DNS by default. While we're here, rename disable_dnsmasq_dns -> ! dnsmasq_enable_dns for consistency. Change-Id: If40f044a86cdde6d653bbfb441de53fb4071e390
This commit is contained in:
parent
aa727de74d
commit
fc7d10a49b
@ -124,7 +124,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
|
||||
@ -164,6 +163,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.
|
||||
|
@ -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 }}"
|
||||
|
@ -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 %}
|
||||
|
||||
|
15
releasenotes/notes/inventory-ddf41d563a320201.yaml
Normal file
15
releasenotes/notes/inventory-ddf41d563a320201.yaml
Normal 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``.
|
Loading…
Reference in New Issue
Block a user