diff --git a/manifests/inspector.pp b/manifests/inspector.pp index 704f82b1..95097fa6 100644 --- a/manifests/inspector.pp +++ b/manifests/inspector.pp @@ -159,6 +159,16 @@ # (optional) Whether to store the boot mode (BIOS or UEFI). # Defaults to $::os_service_default # +# [*node_not_found_hook*] +# (optional) Plugin to run when a node is not found during lookup. +# For example, "enroll" hook can be used for node auto-discovery. +# Defaults to $::os_service_default +# +# [*discovery_default_driver*] +# (optional) The default driver to use for auto-discovered nodes. +# Requires node_not_found_hook set to "enroll". +# Defaults to $::os_service_default +# # DEPRECATED # # [*enable_uefi*] @@ -203,6 +213,8 @@ class ironic::inspector ( $detect_boot_mode = $::os_service_default, $tftp_root = '/tftpboot', $http_root = '/httpboot', + $node_not_found_hook = $::os_service_default, + $discovery_default_driver = $::os_service_default, # DEPRECATED $enable_uefi = undef, ) { @@ -301,6 +313,8 @@ tftpboot and httpboot setup, please include ::ironic::pxe") # Here we use oslo.config interpolation with another option default_processing_hooks, # which we don't change as it might break introspection completely. 'processing/processing_hooks': value => $p_hooks; + 'processing/node_not_found_hook': value => $node_not_found_hook; + 'discovery/enroll_node_driver': value => $discovery_default_driver; } # Install package diff --git a/releasenotes/notes/node-not-found-hook-1695393c50f6692b.yaml b/releasenotes/notes/node-not-found-hook-1695393c50f6692b.yaml new file mode 100644 index 00000000..8f6e7539 --- /dev/null +++ b/releasenotes/notes/node-not-found-hook-1695393c50f6692b.yaml @@ -0,0 +1,8 @@ +--- +features: + - New parameter "node_not_found_hook" allows configuring ironic-inspector + plugin to run when a node is not found during lookup. For example, + "enroll" hook implements node auto-discovery. + - New parameter "discovery_default_driver" allows configuring the default + driver to be set by ironic-inspector for newly discovered nodes, when + "node_not_found_hook" is set to "enroll". diff --git a/spec/classes/ironic_inspector_spec.rb b/spec/classes/ironic_inspector_spec.rb index e989d675..2fc4f034 100644 --- a/spec/classes/ironic_inspector_spec.rb +++ b/spec/classes/ironic_inspector_spec.rb @@ -110,6 +110,8 @@ describe 'ironic::inspector' do is_expected.to contain_ironic_inspector_config('swift/project_name').with_value(p[:swift_tenant_name]) is_expected.to contain_ironic_inspector_config('swift/auth_url').with_value(p[:swift_auth_url]) is_expected.to contain_ironic_inspector_config('processing/processing_hooks').with_value('$default_processing_hooks') + is_expected.to contain_ironic_inspector_config('processing/node_not_found_hook').with_value('') + is_expected.to contain_ironic_inspector_config('discovery/enroll_node_driver').with_value('') end it 'should contain file /etc/ironic-inspector/inspector.conf' do @@ -156,6 +158,8 @@ describe 'ironic::inspector' do :tftp_root => '/var/lib/tftpboot', :http_root => '/var/www/httpboot', :detect_boot_mode => true, + :node_not_found_hook => 'enroll', + :discovery_default_driver => 'pxe_ipmitool', ) end it 'should replace default parameter with new value' do @@ -167,6 +171,8 @@ describe 'ironic::inspector' do is_expected.to contain_ironic_inspector_config('swift/password').with_value(p[:swift_password]) is_expected.to contain_ironic_inspector_config('swift/auth_url').with_value(p[:swift_auth_url]) is_expected.to contain_ironic_inspector_config('processing/processing_hooks').with_value('$default_processing_hooks,hook1,hook2') + is_expected.to contain_ironic_inspector_config('processing/node_not_found_hook').with_value('enroll') + is_expected.to contain_ironic_inspector_config('discovery/enroll_node_driver').with_value('pxe_ipmitool') end it 'should contain file /etc/ironic-inspector/dnsmasq.conf' do