Index: modules/adblockplus/manifests/puppet.pp |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/modules/adblockplus/manifests/puppet.pp |
@@ -0,0 +1,49 @@ |
+# == Class: adblockplus::puppet |
+# |
+# Manage Puppet (https://github.com/puppetlabs/puppet) agent configuration. |
+# |
+# === 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". |
+# |
+# === Examples: |
+# |
+# class {'adblockplus::puppet': |
+# package => { |
+# 'ensure' => 'present', |
+# 'name' => 'puppet', |
+# }, |
+# service => { |
+# 'ensure' => 'stopped', |
+# 'name' => 'puppet', |
+# }, |
+# } |
+# |
+class adblockplus::puppet ( |
+ $package = hiera('adblockplus::puppet::package', {}), |
+ $service = hiera('adblockplus::puppet::service', {}), |
+) { |
+ |
+ # 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)$/ { |
+ |
+ ensure_resource('service', 'puppet', merge({ |
+ 'ensure' => 'stopped', |
+ 'hasrestart' => true, |
+ 'hasstatus' => true, |
+ }, $service)) |
+ |
+ Service['puppet'] <- Package['puppet'] |
+ } |
+} |