Skip to content

Commit 8876af4

Browse files
Merge pull request #133 from atlassian/cwood/puppet-agent-4
Cwood/puppet agent 4
2 parents 84ce802 + 2822547 commit 8876af4

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed

manifests/agent.pp

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
# ['group_id'] - The groupid of the puppet group
1818
# ['splay'] - If splay should be enable defaults to false
1919
# ['splaylimit'] - The maximum time to delay before runs.
20-
# ['classfile'] - The file in which puppet agent stores a list of the classes
21-
# associated with the retrieved configuration.
20+
# ['classfile'] - The file in which puppet agent stores a list of the classes
21+
# associated with the retrieved configuration.
2222
# ['logdir'] - The directory in which to store log files
2323
# ['environment'] - The environment of the puppet agent
2424
# ['report'] - Whether to return reports
@@ -64,7 +64,7 @@
6464
$version = 'present',
6565
$puppet_facter_package = $::puppet::params::puppet_facter_package,
6666
$puppet_run_style = 'service',
67-
$puppet_run_command = '/usr/bin/puppet agent --no-daemonize --onetime --logdest syslog > /dev/null 2>&1',
67+
$puppet_run_command = $::puppet::params::puppet_run_command,
6868
$user_id = undef,
6969
$group_id = undef,
7070
$package_provider = $::puppet::params::package_provider,
@@ -86,7 +86,7 @@
8686
$puppet_run_interval = $::puppet::params::puppet_run_interval,
8787
$splay = false,
8888

89-
# $splaylimit defaults to $runinterval per Puppetlabs docs:
89+
# $splaylimit defaults to $runinterval per Puppetlabs docs:
9090
# http://docs.puppetlabs.com/references/latest/configuration.html#splaylimit
9191
$splaylimit = $::puppet::params::puppet_run_interval,
9292
$classfile = $::puppet::params::classfile,
@@ -407,14 +407,25 @@
407407
section => 'main',
408408
}
409409
}
410-
ini_setting {'puppetagentconfigtimeout':
411-
setting => 'configtimeout',
412-
value => $configtimeout,
413-
}
414-
if $stringify_facts != undef {
410+
if versioncmp($::puppetversion, "4.0.0") < 0 {
411+
ini_setting {'puppetagentconfigtimeout':
412+
setting => 'configtimeout',
413+
value => $configtimeout,
414+
}
415+
if $stringify_facts != undef {
416+
ini_setting {'puppetagentstringifyfacts':
417+
setting => 'stringify_facts',
418+
value => $stringify_facts,
419+
}
420+
}
421+
} else {
422+
ini_setting {'puppetagentconfigtimeout':
423+
setting => 'configtimeout',
424+
ensure => absent,
425+
}
415426
ini_setting {'puppetagentstringifyfacts':
416427
setting => 'stringify_facts',
417-
value => $stringify_facts,
428+
ensure => absent,
418429
}
419430
}
420431
if $verbose != undef {

manifests/params.pp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@
4040
# Only used when environments == directory
4141
$environmentpath = "${confdir}/environments"
4242

43+
if versioncmp($::puppetversion, "4.0.0") >= 0 {
44+
$puppet_conf = '/etc/puppetlabs/puppet/puppet.conf'
45+
$puppet_run_command = '/opt/puppetlabs/bin/puppet agent --no-daemonize --onetime --logdest syslog > /dev/null 2>&1'
46+
$puppet_vardir = '/opt/puppetlabs/server/data/puppetserver'
47+
$puppet_ssldir = '/etc/puppetlabs/puppet/ssl'
48+
} else {
49+
$puppet_conf = '/etc/puppet/puppet.conf'
50+
$puppet_run_command = '/usr/bin/puppet agent --no-daemonize --onetime --logdest syslog > /dev/null 2>&1'
51+
$puppet_vardir = '/var/lib/puppet'
52+
$puppet_ssldir = '/var/lib/puppet/ssl'
53+
}
54+
4355
case $::osfamily {
4456
'RedHat': {
4557
$puppet_master_package = 'puppet-server'
@@ -48,9 +60,6 @@
4860
$puppet_agent_package = 'puppet'
4961
$package_provider = undef # falls back to system default
5062
$puppet_defaults = '/etc/sysconfig/puppet'
51-
$puppet_conf = '/etc/puppet/puppet.conf'
52-
$puppet_vardir = '/var/lib/puppet'
53-
$puppet_ssldir = '/var/lib/puppet/ssl'
5463
$passenger_package = 'mod_passenger'
5564
$rack_package = 'rubygem-rack'
5665
$ruby_dev = 'ruby-devel'
@@ -61,9 +70,6 @@
6170
$puppet_agent_service = 'puppet'
6271
$puppet_agent_package = 'puppet'
6372
$package_provider = undef # falls back to system default
64-
$puppet_conf = '/etc/puppet/puppet.conf'
65-
$puppet_vardir = '/var/lib/puppet'
66-
$puppet_ssldir = '/var/lib/puppet/ssl'
6773
$passenger_package = 'rubygem-passenger-apache2'
6874
$rack_package = 'rubygem-rack'
6975
}
@@ -74,9 +80,6 @@
7480
$puppet_agent_package = 'puppet'
7581
$package_provider = undef # falls back to system default
7682
$puppet_defaults = '/etc/default/puppet'
77-
$puppet_conf = '/etc/puppet/puppet.conf'
78-
$puppet_vardir = '/var/lib/puppet'
79-
$puppet_ssldir = '/var/lib/puppet/ssl'
8083
$passenger_package = 'libapache2-mod-passenger'
8184
$rack_package = 'librack-ruby'
8285
$ruby_dev = 'ruby-dev'
@@ -86,17 +89,12 @@
8689
$puppet_agent_package = 'sysutils/puppet'
8790
$package_provider = undef # falls back to system default
8891
$puppet_conf = '/usr/local/etc/puppet/puppet.conf'
89-
$puppet_vardir = '/var/puppet'
90-
$puppet_ssldir = '/var/puppet/ssl'
9192
}
9293
'Darwin': {
9394
$puppet_agent_service = 'com.puppetlabs.puppet'
9495
$puppet_agent_package = 'puppet-3.8.5.dmg'
9596
$puppet_facter_package = 'facter-2.4.5.dmg'
9697
$package_provider = 'pkgdmg'
97-
$puppet_conf = '/etc/puppet/puppet.conf'
98-
$puppet_vardir = '/var/lib/puppet'
99-
$puppet_ssldir = '/etc/puppet/ssl'
10098
}
10199
default: {
102100
err('The Puppet module does not support your os')

0 commit comments

Comments
 (0)