Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/adblockplus/manifests/puppet.pp

Issue 29367500: Issue 3065 - Introduce adblockplus::puppet::master module (Closed)
Patch Set: Created Dec. 14, 2016, 4:02 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
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']
+ }
+}

Powered by Google App Engine
This is Rietveld