102 lines
2.1 KiB
Puppet
102 lines
2.1 KiB
Puppet
class puppet::agent (
|
|
$ensure = 'present',
|
|
$version = undef,
|
|
$norunifloggedin = false,
|
|
$daemonize = true,
|
|
$run_hour = '*/1',
|
|
$run_minute = '10',
|
|
$run_if_ipmatch = undef,
|
|
$maxsleep = '3200',
|
|
$puppet_master = undef,
|
|
$cron = true,
|
|
$environment = gsub($::domain, '.lan', '')) {
|
|
case $::kernel {
|
|
'Linux' : {
|
|
$puppetpkgs = ['puppet', 'puppet-common']
|
|
|
|
Package {
|
|
provider => 'apt' }
|
|
|
|
if $::lsbdistid != 'Ubuntu' {
|
|
package { 'ruby-msgpack': ensure => $ensure }
|
|
}
|
|
}
|
|
default : {
|
|
$puppetpkgs = 'puppet'
|
|
}
|
|
}
|
|
|
|
$pkg_ens = $ensure ? {
|
|
'present' => $::kernel ? {
|
|
'Linux' => $version,
|
|
default => $ensure,
|
|
},
|
|
default => $ensure,
|
|
}
|
|
|
|
package { $puppetpkgs:
|
|
ensure => $pkg_ens,
|
|
notify => Service['puppet'],
|
|
}
|
|
|
|
service { 'puppet':
|
|
hasstatus => true,
|
|
enable => $daemonize,
|
|
ensure => $daemonize,
|
|
}
|
|
$cron_real = $daemonize ? {
|
|
false => $cron ? {
|
|
true => 'present',
|
|
default => 'absent',
|
|
},
|
|
true => 'absent',
|
|
default => $ensure,
|
|
}
|
|
|
|
cron { 'puppetrun':
|
|
command => '/usr/local/sbin/puppetd_run.sh',
|
|
user => 'root',
|
|
minute => $run_minute,
|
|
hour => $run_hour,
|
|
ensure => $cron_real,
|
|
}
|
|
|
|
file {
|
|
'/usr/local/sbin/puppetd_run.sh':
|
|
content => template('puppet/puppetd_run.sh.erb'),
|
|
mode => '0700',
|
|
alias => 'puppetd_run.sh',
|
|
ensure => $ensure;
|
|
|
|
'/var/log/puppet':
|
|
mode => '0750',
|
|
owner => 'puppet',
|
|
group => 'puppet';
|
|
}
|
|
|
|
# #settings
|
|
if $ensure != 'absent' {
|
|
Ini_setting {
|
|
path => '/etc/puppet/puppet.conf',
|
|
section => 'agent',
|
|
}
|
|
|
|
ini_setting { 'puppet-agent-splay':
|
|
setting => 'splay',
|
|
value => $maxsleep;
|
|
}
|
|
|
|
ini_setting { 'puppet-agent-env':
|
|
setting => 'environment',
|
|
value => $environment;
|
|
}
|
|
|
|
if $puppet_master != undef {
|
|
ini_setting { 'puppet-agnt-master':
|
|
setting => 'server',
|
|
value => $puppet_master,
|
|
}
|
|
}
|
|
}
|
|
}
|