Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dhcp options to allow overrides #422

Merged
merged 2 commits into from
Apr 9, 2018
Merged
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
9 changes: 9 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@
#
# $dhcp_pxeserver:: DHCP "next-server" value, defaults otherwise to IP of dhcp_interface
#
# $dhcp_pxefilename:: DHCP "filename" value, defaults otherwise to pxelinux.0
#
# $dhcp_network:: DHCP server network value, defaults otherwise to value based on IP of dhcp_interface
#
# $dhcp_netmask:: DHCP server netmask value, defaults otherwise to value based on IP of dhcp_interface
#
# $dhcp_server:: Address of DHCP server to manage
#
# $dhcp_config:: DHCP config file path
Expand Down Expand Up @@ -370,6 +376,9 @@
Optional[String] $dhcp_gateway = $::foreman_proxy::params::dhcp_gateway,
Variant[Undef, Boolean, String] $dhcp_range = $::foreman_proxy::params::dhcp_range,
Optional[String] $dhcp_pxeserver = $::foreman_proxy::params::dhcp_pxeserver,
String $dhcp_pxefilename = $::foreman_proxy::params::dhcp_pxefilename,
Optional[String] $dhcp_network = $::foreman_proxy::params::dhcp_network,
Optional[String] $dhcp_netmask = $::foreman_proxy::params::dhcp_netmask,
String $dhcp_nameservers = $::foreman_proxy::params::dhcp_nameservers,
String $dhcp_server = $::foreman_proxy::params::dhcp_server,
Stdlib::Absolutepath $dhcp_config = $::foreman_proxy::params::dhcp_config,
Expand Down
3 changes: 3 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@
$dhcp_option_domain = [$::domain]
$dhcp_search_domains = undef
$dhcp_pxeserver = undef
$dhcp_pxefilename = 'pxelinux.0'
$dhcp_network = undef
$dhcp_netmask = undef
# This will use the IP of the interface in $dhcp_interface, override
# if you need to. You can make this a comma-separated string too - it
# will be split into an array
Expand Down
6 changes: 3 additions & 3 deletions manifests/proxydhcp.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
fail("Could not get the ip address from fact ipaddress_${interface_fact_name}")
}

$net = fact("network_${interface_fact_name}")
$net = pick_default($::foreman_proxy::dhcp_network, fact("network_${interface_fact_name}"))
unless ($net =~ Stdlib::Compat::Ipv4) {
fail("Could not get the network address from fact network_${interface_fact_name}")
}

$mask = fact("netmask_${interface_fact_name}")
$mask = pick_default($::foreman_proxy::dhcp_netmask, fact("netmask_${interface_fact_name}"))
unless ($mask =~ Stdlib::Compat::Ipv4) {
fail("Could not get the network mask from fact netmask_${interface_fact_name}")
}
Expand All @@ -35,7 +35,7 @@
nameservers => $nameservers,
interfaces => [$foreman_proxy::dhcp_interface] + $foreman_proxy::dhcp_additional_interfaces,
pxeserver => $ip,
pxefilename => 'pxelinux.0',
pxefilename => $foreman_proxy::dhcp_pxefilename,
omapi_name => $foreman_proxy::dhcp_key_name,
omapi_key => $foreman_proxy::dhcp_key_secret,
}
Expand Down