Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@

contain foreman_proxy::module::bmc

contain foreman_proxy::module::wol

contain foreman_proxy::module::dhcp
foreman_proxy::provider { ['dhcp_isc', 'dhcp_libvirt']:
}
Expand Down
6 changes: 6 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@
#
# $bmc_ssh_poweron:: BMC SSH poweron command.
#
# $wol:: Enable WOL feature
#
# $wol_listen_on:: WOL proxy to listen on https, http, or both
#
# $keyfile:: DNS server keyfile path
#
# $realm:: Enable realm management feature
Expand Down Expand Up @@ -404,6 +408,8 @@
# lint:ignore:quoted_booleans
String $bmc_ssh_poweron = 'false',
# lint:endignore
Boolean $wol = false,
Foreman_proxy::ListenOn $wol_listen_on = 'https',
Boolean $realm = false,
Foreman_proxy::ListenOn $realm_listen_on = 'https',
String $realm_provider = 'freeipa',
Expand Down
17 changes: 17 additions & 0 deletions manifests/module/wol.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# @summary The built in WOL module
#
# @param enabled
# Whether the module is enabled or disabled.
#
# @param listen_on
# Where to listen on.
class foreman_proxy::module::wol (
Boolean $enabled = $foreman_proxy::wol,
Foreman_proxy::ListenOn $listen_on = $foreman_proxy::wol_listen_on,
) {
foreman_proxy::module { 'wol':
enabled => $enabled,
feature => 'WOL',
listen_on => $listen_on,
}
}
20 changes: 19 additions & 1 deletion spec/classes/foreman_proxy__spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
'logs', 'httpboot', 'puppet', 'puppet_proxy_puppet_api',
'puppetca', 'puppetca_http_api', 'puppetca_puppet_cert',
'puppetca_hostname_whitelisting', 'puppetca_token_whitelisting',
'realm', 'templates', 'tftp'
'realm', 'templates', 'tftp', 'wol'
].each do |cfile|
should contain_file("#{etc_dir}/foreman-proxy/settings.d/#{cfile}.yml")
.with_owner('root')
Expand Down Expand Up @@ -151,6 +151,13 @@
])
end

it 'should generate correct wol.yml' do
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/wol.yml", [
'---',
':enabled: false',
])
end

it 'should generate correct dhcp.yml' do
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/dhcp.yml", [
'---',
Expand Down Expand Up @@ -536,6 +543,17 @@
end
end

context 'with wol' do
let(:params) { super().merge(wol: true) }

it 'should enable wol' do
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/wol.yml", [
'---',
':enabled: https',
])
end
end

context 'only http enabled' do
let(:params) { super().merge(ssl: false, http: true) }

Expand Down
7 changes: 7 additions & 0 deletions templates/wol.yml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# Can be true, false, or http/https to enable just one of the protocols
:enabled: <%= @module_enabled %>

# Wake-on-LAN configuration
# The module sends standard WoL magic packets via UDP broadcast on port 9
# No additional configuration is required as it uses the standard protocol
Loading