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