Index: modules/adblockplus/manifests/puppet.pp |
=================================================================== |
--- a/modules/adblockplus/manifests/puppet.pp |
+++ b/modules/adblockplus/manifests/puppet.pp |
@@ -1,49 +1,51 @@ |
# == Class: adblockplus::puppet |
# |
-# Manage Puppet (https://github.com/puppetlabs/puppet) agent configuration. |
+# Manage Puppet (https://github.com/puppetlabs/puppet) resources. |
# |
# === Parameters: |
# |
-# [*package*] |
-# Custom parameters for the implicit Package['puppet'] resource. |
-# |
-# [*service*] |
-# Custom parameters for the Service['puppet'] resource implicitly defined |
-# if Package['puppet'] is ensured to be neither "absent" nor "purged". |
+# [*ensure*] |
+# General target policy for Puppet resources, supported values include |
+# "present", "latest", "absent" and "purged". |
# |
# === Examples: |
# |
# class {'adblockplus::puppet': |
-# package => { |
-# 'ensure' => 'present', |
-# 'name' => 'puppet', |
-# }, |
-# service => { |
-# 'ensure' => 'stopped', |
-# 'name' => 'puppet', |
-# }, |
+# ensure => 'latest', |
# } |
# |
class adblockplus::puppet ( |
- $package = hiera('adblockplus::puppet::package', {}), |
- $service = hiera('adblockplus::puppet::service', {}), |
+ $ensure = 'present', |
) { |
# https://forge.puppet.com/puppetlabs/stdlib |
include stdlib |
- # https://forge.puppet.com/puppetlabs/stdlib#ensure_resource |
- ensure_resource('package', 'puppet', $package) |
- |
- # https://forge.puppet.com/puppetlabs/stdlib#getparam |
- if getparam(Package['puppet'], 'ensure') !~ /^(absent|purged)$/ { |
+ if $ensure !~ /^(absent|purged)$/ { |
+ $ensure_directory = 'directory' |
+ $ensure_file = 'file' |
+ } |
+ else { |
+ $ensure_directory = 'absent' |
+ $ensure_file = 'absent' |
+ } |
- ensure_resource('service', 'puppet', merge({ |
- 'ensure' => 'stopped', |
- 'hasrestart' => true, |
- 'hasstatus' => true, |
- }, $service)) |
+ # https://tickets.puppetlabs.com/browse/PUP-3655 |
+ ensure_resource('file', '/var/lib/puppet/facts.d', { |
+ ensure => $ensure_directory, |
+ group => 'root', |
+ mode => 0755, |
+ owner => 'root', |
+ }) |
- Service['puppet'] <- Package['puppet'] |
- } |
+ # http://stackoverflow.com/questions/22816946/ |
+ ensure_resource('file', '/var/lib/puppet/facts.d/pup3665', { |
+ 'content' => "#!/bin/sh\necho 'pup3665=workaround'\n", |
+ 'ensure' => $ensure_file, |
+ 'group' => 'root', |
+ 'mode' => 0755, |
+ 'owner' => 'root', |
+ }) |
+ |
+ File['/var/lib/puppet/facts.d'] -> File['/var/lib/puppet/facts.d/pup3665'] |
} |