diff --git a/manifests/inspector.pp b/manifests/inspector.pp index 9b98d34f..56ec9338 100644 --- a/manifests/inspector.pp +++ b/manifests/inspector.pp @@ -167,6 +167,10 @@ # (optional) IP interface for the dnsmasq process # Defaults to '192.168.0.1' # +# [*dnsmasq_dhcp_sequential_ip*] +# (optional) When true enable the 'dhcp-sequential-ip' option for dnsmasq. +# Defaults to true +# # [*dnsmasq_dhcp_hostsdir*] # (optional) directory with DHCP hosts, only used with the "dnsmasq" PXE # filter. @@ -269,6 +273,7 @@ class ironic::inspector ( $swift_auth_url = 'http://127.0.0.1:5000/v3', $dnsmasq_ip_subnets = [], $dnsmasq_local_ip = '192.168.0.1', + $dnsmasq_dhcp_sequential_ip = true, $dnsmasq_dhcp_hostsdir = undef, $sync_db = true, $ramdisk_collectors = 'default', diff --git a/releasenotes/notes/dnsmasq-sequential-ip-configurable-739924e5ee69a51d.yaml b/releasenotes/notes/dnsmasq-sequential-ip-configurable-739924e5ee69a51d.yaml new file mode 100644 index 00000000..7d44aef7 --- /dev/null +++ b/releasenotes/notes/dnsmasq-sequential-ip-configurable-739924e5ee69a51d.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + It is now possible to disable sequential ip addressing in the ironic + inspector dnsmasq service. The ``ironic::inspector`` class has the new + parameter ``dnsmasq_dhcp_sequential_ip`` *(defaults to: true)*. Set it + to ``false`` to disable sequential ip addressing. diff --git a/spec/classes/ironic_inspector_spec.rb b/spec/classes/ironic_inspector_spec.rb index a4406f18..dcd289a6 100644 --- a/spec/classes/ironic_inspector_spec.rb +++ b/spec/classes/ironic_inspector_spec.rb @@ -182,6 +182,9 @@ describe 'ironic::inspector' do is_expected.not_to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content( /dhcp-option=tag:subnet3,option:router,2001:4888:a03:313a:c0:fe0:0:c000/ ) + is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content( + /dhcp-sequential-ip/ + ) end it 'should contain file /tftpboot/pxelinux.cfg/default' do is_expected.to contain_file('/tftpboot/pxelinux.cfg/default').with( @@ -220,6 +223,7 @@ describe 'ironic::inspector' do :node_not_found_hook => 'enroll', :discovery_default_driver => 'pxe_ipmitool', :dnsmasq_ip_subnets => [{'ip_range' => '192.168.0.100,192.168.0.120'}], + :dnsmasq_dhcp_sequential_ip => false, :add_ports => 'all', :always_store_ramdisk_logs => true, ) @@ -266,6 +270,9 @@ describe 'ironic::inspector' do is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content( /dhcp-option=tag:ipxe6,option6:bootfile-url,http:\/\/.*:3816\/inspector.ipxe/ ) + is_expected.not_to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content( + /dhcp-sequential-ip/ + ) end it 'should contain file /var/www/httpboot/inspector.ipxe' do is_expected.to contain_file('/var/www/httpboot/inspector.ipxe').with( diff --git a/templates/inspector_dnsmasq_http.erb b/templates/inspector_dnsmasq_http.erb index e6af0506..37c8af86 100644 --- a/templates/inspector_dnsmasq_http.erb +++ b/templates/inspector_dnsmasq_http.erb @@ -38,7 +38,9 @@ dhcp-option=option:classless-static-route,<%= @_routes.join(',') -%> <% end -%> <% end -%> <% end -%> +<% if @dnsmasq_dhcp_sequential_ip -%> dhcp-sequential-ip +<% end -%> dhcp-match=ipxe,175 dhcp-match=set:efi,option:client-arch,7 dhcp-match=set:efi,option:client-arch,9 diff --git a/templates/inspector_dnsmasq_tftp.erb b/templates/inspector_dnsmasq_tftp.erb index db3b06ce..6cda44f5 100644 --- a/templates/inspector_dnsmasq_tftp.erb +++ b/templates/inspector_dnsmasq_tftp.erb @@ -39,7 +39,9 @@ dhcp-option=option:classless-static-route,<%= @_routes.join(',') -%> <% end -%> <% end -%> dhcp-boot=pxelinux.0,localhost.localdomain,<%= @dnsmasq_local_ip %> +<% if @dnsmasq_dhcp_sequential_ip -%> dhcp-sequential-ip +<% end -%> <% if @dnsmasq_dhcp_hostsdir %> dhcp-hostsdir=<%= @dnsmasq_dhcp_hostsdir %> <% end %>