Merge "Deprecate 'dnsmasq_ip_range' replaced by 'dnsmasq_ip_subnets'"
This commit is contained in:
commit
d3589fc525
@ -127,23 +127,22 @@
|
||||
# (optional) Keystone authentication URL for Swift
|
||||
# Defautls to 'http://127.0.0.1:5000/v2.0'
|
||||
#
|
||||
# [*dnsmasq_ip_range*]
|
||||
# (optional) IP range to use for nodes being introspected
|
||||
# Defaults to '192.168.0.100,192.168.0.120'
|
||||
#
|
||||
# [*dnsmasq_ip_subnets*]
|
||||
# (optional) List of hashes with keys: 'tag', 'ip_range', 'netmask', and
|
||||
# 'gateway'. Assigning additional subnets allow dnsmasq to serve dhcp
|
||||
# request that came in via dhcp relay/helper.
|
||||
# [ { tag => 'subnet1',
|
||||
# ip_range => '192.168.0.100,192.168.0.200',
|
||||
# netmask => '255.255.255.0',
|
||||
# gateway => '192.168.0.254' },
|
||||
# { tag => 'subnet2',
|
||||
# ip_range => '192.168.1.100,192.168.1.200',
|
||||
# netmask => '255.255.255.0',
|
||||
# gateway => '192.168.1.254' } ]
|
||||
# Defaults to undef
|
||||
# 'gateway'. 'ip_range' is the only required key. Assigning multiple tagged
|
||||
# subnets allow dnsmasq to serve dhcp request that came in via dhcp
|
||||
# relay/helper.
|
||||
# Example:
|
||||
# [{'ip_range' => '192.168.0.100,192.168.0.120'},
|
||||
# {'tag' => 'subnet1',
|
||||
# 'ip_range' => '192.168.1.100,192.168.1.200',
|
||||
# 'netmask' => '255.255.255.0',
|
||||
# 'gateway' => '192.168.1.254'},
|
||||
# {'tag' => 'subnet2',
|
||||
# 'ip_range' => '192.168.2.100,192.168.2.200',
|
||||
# 'netmask' => '255.255.255.0',
|
||||
# 'gateway' => '192.168.2.254'}]
|
||||
# Defaults to []
|
||||
#
|
||||
# [*dnsmasq_local_ip*]
|
||||
# (optional) IP interface for the dnsmasq process
|
||||
@ -207,6 +206,9 @@
|
||||
# (optional) Enable setting of IPMI credentials
|
||||
# Defaults to $::os::service_default
|
||||
#
|
||||
# [*dnsmasq_ip_range*]
|
||||
# (optional) IP range to use for nodes being introspected
|
||||
# Defaults to undef
|
||||
class ironic::inspector (
|
||||
$package_ensure = 'present',
|
||||
$enabled = true,
|
||||
@ -235,8 +237,7 @@ class ironic::inspector (
|
||||
$swift_project_domain_name = $::os_service_default,
|
||||
$swift_user_domain_name = $::os_service_default,
|
||||
$swift_auth_url = 'http://127.0.0.1:5000/v2.0',
|
||||
$dnsmasq_ip_range = '192.168.0.100,192.168.0.120',
|
||||
$dnsmasq_ip_subnets = undef,
|
||||
$dnsmasq_ip_subnets = [],
|
||||
$dnsmasq_local_ip = '192.168.0.1',
|
||||
$sync_db = true,
|
||||
$ramdisk_collectors = 'default',
|
||||
@ -250,6 +251,7 @@ class ironic::inspector (
|
||||
$node_not_found_hook = $::os_service_default,
|
||||
$discovery_default_driver = $::os_service_default,
|
||||
# DEPRECATED
|
||||
$dnsmasq_ip_range = undef,
|
||||
$enable_uefi = undef,
|
||||
$enable_setting_ipmi_credentials = $::os_service_default,
|
||||
) {
|
||||
@ -268,6 +270,18 @@ class ironic::inspector (
|
||||
warning('enable_setting_ipmi_credentials is deprecated')
|
||||
}
|
||||
|
||||
if !is_array($dnsmasq_ip_subnets) {
|
||||
fail('Invalid data type, parameter dnsmasq_ip_subnets must be Array type')
|
||||
}
|
||||
|
||||
if $dnsmasq_ip_range {
|
||||
warning('dnsmasq_ip_range is deprecated, replaced by dnsmasq_ip_subnets')
|
||||
$dnsmasq_ip_subnets_real = concat($dnsmasq_ip_subnets,
|
||||
{'ip_range' => $dnsmasq_ip_range})
|
||||
} else {
|
||||
$dnsmasq_ip_subnets_real = $dnsmasq_ip_subnets
|
||||
}
|
||||
|
||||
if $enable_uefi == undef {
|
||||
warning('UEFI will be enabled by default starting with Pike')
|
||||
} else {
|
||||
|
@ -1,6 +1,33 @@
|
||||
---
|
||||
features:
|
||||
- Assigning additional subnets allow dnsmasq to serve dhcp request that came
|
||||
in via dhcp relay/helper.
|
||||
Adds parameter 'dnsmasq_ip_subnets' and enable configuration of dhcp-range
|
||||
and dhcp-option 'option:router' for additional subnets in dnsmasq.
|
||||
- |
|
||||
Assigning additional subnets allow dnsmasq to serve dhcp request that came
|
||||
in via dhcp relay/helper. New parameter 'dnsmasq_ip_subnets' enable
|
||||
configuration of dhcp-range and dhcp-option 'option:router' for multiple
|
||||
subnets in dnsmasq.
|
||||
|
||||
Example::
|
||||
|
||||
$dnsmasq_ip_subnets = [{'ip_range' => '192.168.0.100,192.168.0.120'},
|
||||
{'tag' => 'subnet1',
|
||||
'ip_range' => '192.168.1.100,192.168.1.200',
|
||||
'netmask' => '255.255.255.0',
|
||||
'gateway' => '192.168.1.254'},
|
||||
{'tag' => 'subnet2',
|
||||
'ip_range' => '192.168.2.100,192.168.2.200',
|
||||
'netmask' => '255.255.255.0',
|
||||
'gateway' => '192.168.2.254'}]
|
||||
|
||||
deprecations:
|
||||
- The "ironic::inspector::dnsmasq_ip_range" parameter was deprecated in favor
|
||||
of "ironic::inspector::dnsmasq_ip_subnets"
|
||||
upgrade:
|
||||
- |
|
||||
Replace usage of "ironic::inspector::dnsmasq_ip_range" with
|
||||
"ironic::inspector::dnsmasq_ip_subnets". For example, if you have::
|
||||
|
||||
$dnsmasq_ip_range = '192.168.0.100,192.168.0.120'
|
||||
|
||||
replace with::
|
||||
|
||||
$dnsmasq_ip_subnets = [{'ip_range' => '192.168.0.100,192.168.0.120'}]
|
||||
|
@ -26,32 +26,40 @@ describe 'ironic::inspector' do
|
||||
end
|
||||
|
||||
let :params do
|
||||
{ :package_ensure => 'present',
|
||||
:enabled => true,
|
||||
:pxe_transfer_protocol => 'tftp',
|
||||
:enable_uefi => false,
|
||||
:auth_strategy => 'keystone',
|
||||
:dnsmasq_interface => 'br-ctlplane',
|
||||
:ramdisk_logs_dir => '/var/log/ironic-inspector/ramdisk/',
|
||||
:keep_ports => 'all',
|
||||
:store_data => 'none',
|
||||
:ironic_auth_type => 'password',
|
||||
:ironic_username => 'ironic',
|
||||
:ironic_tenant_name => 'services',
|
||||
:ironic_auth_url => 'http://127.0.0.1:5000/v2.0',
|
||||
:ironic_max_retries => 30,
|
||||
:ironic_retry_interval => 2,
|
||||
:swift_auth_type => 'password',
|
||||
:swift_username => 'ironic',
|
||||
:swift_tenant_name => 'services',
|
||||
:swift_auth_url => 'http://127.0.0.1:5000/v2.0',
|
||||
:dnsmasq_ip_range => '192.168.0.100,192.168.0.120',
|
||||
:dnsmasq_ip_subnets => false,
|
||||
:dnsmasq_local_ip => '192.168.0.1',
|
||||
:ipxe_timeout => 0,
|
||||
:http_port => 8088,
|
||||
:tftp_root => '/tftpboot',
|
||||
:http_root => '/httpboot', }
|
||||
{ :package_ensure => 'present',
|
||||
:enabled => true,
|
||||
:pxe_transfer_protocol => 'tftp',
|
||||
:enable_uefi => false,
|
||||
:auth_strategy => 'keystone',
|
||||
:dnsmasq_interface => 'br-ctlplane',
|
||||
:ramdisk_logs_dir => '/var/log/ironic-inspector/ramdisk/',
|
||||
:keep_ports => 'all',
|
||||
:store_data => 'none',
|
||||
:ironic_auth_type => 'password',
|
||||
:ironic_username => 'ironic',
|
||||
:ironic_tenant_name => 'services',
|
||||
:ironic_auth_url => 'http://127.0.0.1:5000/v2.0',
|
||||
:ironic_max_retries => 30,
|
||||
:ironic_retry_interval => 2,
|
||||
:swift_auth_type => 'password',
|
||||
:swift_username => 'ironic',
|
||||
:swift_tenant_name => 'services',
|
||||
:swift_auth_url => 'http://127.0.0.1:5000/v2.0',
|
||||
:dnsmasq_ip_subnets => [{ 'ip_range' =>
|
||||
'192.168.0.100,192.168.0.120' },
|
||||
{ 'tag' => 'subnet1',
|
||||
'ip_range' => '192.168.1.100,192.168.1.200',
|
||||
'netmask' => '255.255.255.0',
|
||||
'gateway' => '192.168.1.254' },
|
||||
{ 'tag' => 'subnet2',
|
||||
'ip_range' => '192.168.2.100,192.168.2.200',
|
||||
'netmask' => '255.255.255.0',
|
||||
'gateway' => '192.168.2.254' }],
|
||||
:dnsmasq_local_ip => '192.168.0.1',
|
||||
:ipxe_timeout => 0,
|
||||
:http_port => 8088,
|
||||
:tftp_root => '/tftpboot',
|
||||
:http_root => '/httpboot', }
|
||||
end
|
||||
|
||||
|
||||
@ -130,6 +138,21 @@ describe 'ironic::inspector' do
|
||||
'require' => 'Anchor[ironic-inspector::config::begin]',
|
||||
'content' => /pxelinux/,
|
||||
)
|
||||
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
|
||||
/dhcp-range=192.168.0.100,192.168.0.120,29/
|
||||
)
|
||||
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
|
||||
/dhcp-range=set:subnet1,192.168.1.100,192.168.1.200,255.255.255.0,29/
|
||||
)
|
||||
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
|
||||
/dhcp-option=tag:subnet1,option:router,192.168.1.254/
|
||||
)
|
||||
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
|
||||
/dhcp-range=set:subnet2,192.168.2.100,192.168.2.200,255.255.255.0,29/
|
||||
)
|
||||
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
|
||||
/dhcp-option=tag:subnet2,option:router,192.168.2.254/
|
||||
)
|
||||
end
|
||||
it 'should contain file /tftpboot/pxelinux.cfg/default' do
|
||||
is_expected.to contain_file('/tftpboot/pxelinux.cfg/default').with(
|
||||
@ -168,14 +191,8 @@ describe 'ironic::inspector' do
|
||||
:detect_boot_mode => true,
|
||||
:node_not_found_hook => 'enroll',
|
||||
:discovery_default_driver => 'pxe_ipmitool',
|
||||
:dnsmasq_ip_subnets => [ { 'tag' => 'subnet1',
|
||||
'ip_range' => '192.168.1.100,192.168.1.200',
|
||||
'netmask' => '255.255.255.0',
|
||||
'gateway' => '192.168.1.254' },
|
||||
{ 'tag' => 'subnet2',
|
||||
'ip_range' => '192.168.2.100,192.168.2.200',
|
||||
'netmask' => '255.255.255.0',
|
||||
'gateway' => '192.168.2.254' } ],
|
||||
:dnsmasq_ip_subnets => [],
|
||||
:dnsmasq_ip_range => '192.168.0.100,192.168.0.120',
|
||||
)
|
||||
end
|
||||
it 'should replace default parameter with new value' do
|
||||
@ -205,16 +222,7 @@ describe 'ironic::inspector' do
|
||||
/dhcp-boot=tag:ipxe,http:\/\/192.168.0.1:3816\/inspector.ipxe/
|
||||
)
|
||||
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
|
||||
/dhcp-range=set:subnet1,192.168.1.100,192.168.1.200,255.255.255.0,29/
|
||||
)
|
||||
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
|
||||
/dhcp-option=tag:subnet1,option:router,192.168.1.254/
|
||||
)
|
||||
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
|
||||
/dhcp-range=set:subnet2,192.168.2.100,192.168.2.200,255.255.255.0,29/
|
||||
)
|
||||
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
|
||||
/dhcp-option=tag:subnet2,option:router,192.168.2.254/
|
||||
/dhcp-range=192.168.0.100,192.168.0.120,29/
|
||||
)
|
||||
end
|
||||
it 'should contain file /var/www/httpboot/inspector.ipxe' do
|
||||
|
@ -1,13 +1,22 @@
|
||||
port=0
|
||||
interface=<%= @dnsmasq_interface %>
|
||||
bind-interfaces
|
||||
<% if @dnsmasq_ip_subnets.is_a?(Array) -%>
|
||||
<% @dnsmasq_ip_subnets.each do |s| -%>
|
||||
<% @dnsmasq_ip_subnets_real.each do |s| -%>
|
||||
<% if s['tag'] and s['netmask'] -%>
|
||||
dhcp-range=set:<%= s['tag'] -%>,<%= s['ip_range'] -%>,<%= s['netmask'] -%>,29
|
||||
<% elsif s['tag'] -%>
|
||||
dhcp-range=set:<%= s['tag'] -%>,<%= s['ip_range'] -%>,29
|
||||
<% else -%>
|
||||
dhcp-range=<%= s['ip_range'] -%>,29
|
||||
<% end -%>
|
||||
<% if s['gateway'] -%>
|
||||
<% if s['tag'] -%>
|
||||
dhcp-option=tag:<%= s['tag'] -%>,option:router,<%= s['gateway'] %>
|
||||
<% else -%>
|
||||
dhcp-option=option:router,<%= s['gateway'] %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
dhcp-range=<%= @dnsmasq_ip_range %>,29
|
||||
dhcp-sequential-ip
|
||||
dhcp-match=ipxe,175
|
||||
<% if @enable_uefi -%>
|
||||
|
@ -1,12 +1,21 @@
|
||||
port=0
|
||||
interface=<%= @dnsmasq_interface %>
|
||||
bind-interfaces
|
||||
<% if @dnsmasq_ip_subnets.is_a?(Array) -%>
|
||||
<% @dnsmasq_ip_subnets.each do |s| -%>
|
||||
<% @dnsmasq_ip_subnets_real.each do |s| -%>
|
||||
<% if s['tag'] and s['netmask'] -%>
|
||||
dhcp-range=set:<%= s['tag'] -%>,<%= s['ip_range'] -%>,<%= s['netmask'] -%>,29
|
||||
<% elsif s['tag'] -%>
|
||||
dhcp-range=set:<%= s['tag'] -%>,<%= s['ip_range'] -%>,29
|
||||
<% else -%>
|
||||
dhcp-range=<%= s['ip_range'] -%>,29
|
||||
<% end -%>
|
||||
<% if s['gateway'] -%>
|
||||
<% if s['tag'] -%>
|
||||
dhcp-option=tag:<%= s['tag'] -%>,option:router,<%= s['gateway'] %>
|
||||
<% else -%>
|
||||
dhcp-option=option:router,<%= s['gateway'] %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
dhcp-range=<%= @dnsmasq_ip_range %>,29
|
||||
dhcp-boot=pxelinux.0,localhost.localdomain,<%= @dnsmasq_local_ip %>
|
||||
dhcp-sequential-ip
|
||||
|
Loading…
Reference in New Issue
Block a user