Skip to content

Commit

Permalink
Merge pull request theforeman#2 from GregSutcliffe/master
Browse files Browse the repository at this point in the history
Master forked to "oldstable" for older puppet users
Merged to master
  • Loading branch information
GregSutcliffe committed May 7, 2012
2 parents 647b1e2 + d44b38e commit a80183e
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 12 deletions.
8 changes: 5 additions & 3 deletions manifests/config.pp
Expand Up @@ -8,7 +8,7 @@
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,
Expand All @@ -33,7 +33,9 @@

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 }

}
47 changes: 43 additions & 4 deletions manifests/params.pp
Expand Up @@ -10,21 +10,60 @@
# puppetca settings
$puppetca = true
$autosign_location = '/etc/puppet/autosign.conf'
$puppetca_cmd = '/usr/sbin/puppetca'
$puppetca_cmd = '/usr/sbin/puppet cert'
$puppet_group = 'puppet'

# puppetrun settings
$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'
}
}

}
32 changes: 32 additions & 0 deletions manifests/proxydhcp.pp
@@ -0,0 +1,32 @@
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}",
}


}
16 changes: 16 additions & 0 deletions manifests/proxydns.pp
@@ -0,0 +1,16 @@
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}",
}
}
2 changes: 1 addition & 1 deletion manifests/puppetca.pp
Expand Up @@ -4,7 +4,7 @@
ensure => present,
owner => $foreman_proxy::params::user,
group => $foreman_proxy::params::puppet_group,
mode => '0644',
mode => '0664',
require => Class['foreman_proxy::install'],
}

Expand Down
8 changes: 5 additions & 3 deletions manifests/service.pp
@@ -1,6 +1,8 @@
class foreman_proxy::service {
service {'foreman-proxy':
ensure => running,
require => Class['foreman_proxy::config']

service { 'foreman-proxy':
ensure => running,
require => Class['foreman_proxy::config'],
}

}
9 changes: 8 additions & 1 deletion templates/settings.yml.erb
Expand Up @@ -23,17 +23,23 @@
# 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
Expand All @@ -47,6 +53,7 @@
#: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") %>
Expand Down

0 comments on commit a80183e

Please sign in to comment.