Project

General

Profile

« Previous | Next » 

Revision d44b38ec

Added by Greg Sutcliffe about 12 years ago

Enable optional DHCP/DNS modules

View differences:

manifests/config.pp
require => Class['foreman_proxy::install'],
notify => Class['foreman_proxy::service'],
}
file{'/etc/foreman-proxy/settings.yml':
content => template('foreman_proxy/settings.yml.erb'),
owner => $foreman_proxy::params::user,
......
if $foreman_proxy::params::puppetca { include foreman_proxy::puppetca }
if $foreman_proxy::params::tftp { include foreman_proxy::tftp }
#if $foreman_proxy::params::dhcp { include foreman_proxy::dhcp }
#if $foreman_proxy::params::dns { include foreman_proxy::dns }
# Somehow, calling these DHCP and DNS seems to conflict. So, they get a prefix...
if $foreman_proxy::params::dhcp { include foreman_proxy::proxydhcp }
if $foreman_proxy::params::dns { include foreman_proxy::proxydns }
}
manifests/params.pp
$puppetrun = true
$puppetrun_cmd = '/usr/sbin/puppetrun'
# TFTP settings
# TFTP settings - requires optional TFTP puppet module
$tftp = true
$syslinux_root = '/usr/share/syslinux'
$syslinux_files = ['pxelinux.0','menu.c32','chain.c32']
case $::operatingsystem {
Debian,Ubuntu: {
$syslinux_root = '/usr/lib/syslinux'
$syslinux_files = ['pxelinux.0','menu.c32','chain.c32']
}
default: {
$syslinux_root = '/usr/share/syslinux'
$syslinux_files = ['pxelinux.0','menu.c32','chain.c32']
}
}
$tftproot = $tftp::params::root
$tftp_dir = ["${tftproot}/pxelinux.cfg","${tftproot}/boot"]
$servername = $ipaddress_eth0
# DHCP settings - requires optional DHCP puppet module
$dhcp = false
$gateway = '192.168.100.1'
$range = '192.168.100.50 192.168.100.200'
case $::operatingsystem {
Debian: {
$dhcp_vendor = 'isc'
$dhcp_config = '/etc/dhcp/dhcpd.conf'
$dhcp_leases = '/var/lib/dhcp/dhcpd.leases'
}
Ubuntu: {
$dhcp_vendor = 'isc'
$dhcp_config = '/etc/dhcp3/dhcpd.conf'
$dhcp_leases = '/var/lib/dhcp3/dhcpd.leases'
}
default: {
$dhcp_vendor = 'isc'
$dhcp_config = '/etc/dhcpd.conf'
$dhcp_leases = '/var/lib/dhcpd/dhcpd.leases'
}
}
# DNS settings - requires optional DNS puppet module
$dns = false
case $::operatingsystem {
Debian: {
$keyfile = '/etc/bind/rndc.key'
}
default: {
$keyfile = '/etc/rndc.key'
}
}
}
manifests/proxydhcp.pp
class foreman_proxy::proxydhcp {
include foreman_proxy::params
package { "net-ping":
ensure => installed,
provider => 'gem',
}
class { 'dhcp':
dnsdomain => [
"${::domain}",
"100.168.192.in-addr.arpa",
],
nameservers => ["${::ipaddress}"],
ntpservers => ['us.pool.ntp.org'],
interfaces => ['eth0'],
#dnsupdatekey => "/etc/bind/keys.d/foreman",
#require => Bind::Key[ 'foreman' ],
pxeserver => "${::ipaddress}",
pxefilename => 'pxelinux.0',
dhcp_monitor => false,
}
dhcp::pool{ "${::domain}":
network => "${::network_eth0}",
mask => "${::netmask_eth0}",
range => "${foreman_proxy::params::range}",
gateway => "${foreman_proxy::params::gateway}",
}
}
manifests/proxydns.pp
class foreman_proxy::proxydns {
include foreman_proxy::params
include dns
dns::zone { "${::domain}":
soa => "${::fqdn}",
reverse => "false",
soaip => "${::ipaddress}",
}
dns::zone { "100.168.192.in-addr.arpa":
soa => "${::fqdn}",
reverse => "true",
soaip => "${::ipaddress}",
}
}
manifests/service.pp
class foreman_proxy::service {
service {'foreman-proxy':
ensure => running,
require => Class['foreman_proxy::config']
service { 'foreman-proxy':
ensure => running,
require => Class['foreman_proxy::config'],
}
}
templates/settings.yml.erb
# Enable TFTP management
:tftp: <%= scope.lookupvar("foreman_proxy::params::tftp") %>
:tftproot: <%= scope.lookupvar("foreman_proxy::params::tftproot") %>
:tftp_servername: <%= scope.lookupvar("foreman_proxy::params::servername") %>
# Defines the TFTP Servername to use, overrides the name in the subnet declaration
#:tftp_servername: tftp.domain.com
# Enable DNS management
:dns: <%= scope.lookupvar("foreman_proxy::params::dns") %>
#:dns_key: /etc/rndc.key
:dns_key: <%= scope.lookupvar("foreman_proxy::params::keyfile") %>
# use this setting if you are managing a dns server which is not localhost though this proxy
#:dns_server: dns.domain.com
# Enable DHCP management
:dhcp: <%= scope.lookupvar("foreman_proxy::params::dhcp") %>
<% if scope.lookupvar("foreman_proxy::params::dhcp") == true -%>
:dhcp_vendor: <%= scope.lookupvar("foreman_proxy::params::dhcp_vendor") %>
:dhcp_config: <%= scope.lookupvar("foreman_proxy::params::dhcp_config") %>
:dhcp_leases: <%= scope.lookupvar("foreman_proxy::params::dhcp_leases") %>
<% else -%>
# The vendor can be either isc or native_ms
:dhcp_vendor: isc
# dhcp_subnets is a Native MS implementation setting. It restricts the subnets queried to a
......
#:dhcp_leases: /var/lib/dhcpd/dhcpd.leases
#:dhcp_key_name: secret_key_name
#:dhcp_key_secret: secret_key
<% end -%>
# enable PuppetCA management
:puppetca: <%= scope.lookupvar("foreman_proxy::params::puppetca") %>

Also available in: Unified diff