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

Unified Diff: modules/adblockplus/manifests/puppet/master.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
« no previous file with comments | « modules/adblockplus/manifests/puppet.pp ('k') | modules/private-stub/hiera/hosts.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/adblockplus/manifests/puppet/master.pp
===================================================================
new file mode 100644
--- /dev/null
+++ b/modules/adblockplus/manifests/puppet/master.pp
@@ -0,0 +1,50 @@
+# == Class: adblockplus::puppet::master
+#
+# Manage Puppet (https://github.com/puppetlabs/puppet) master configuration.
+#
+# === Parameters:
+#
+# [*package*]
+# Custom parameters for the implicit Package['puppetmaster'] resource.
+#
+# [*service*]
+# Custom parameters for the Service['puppetmaster'] resource implicitly
+# defined the package is ensured to be neither "absent" nor "purged".
+#
+# === Examples:
+#
+# class {'adblockplus::puppet::master':
+# package => {
+# 'ensure' => 'present',
+# 'name' => 'puppetmaster',
+# },
+# service => {
+# 'ensure' => 'running',
+# 'name' => 'puppetmaster',
+# },
+# }
+#
+class adblockplus::puppet::master (
+ $package = hiera('adblockplus::puppet::master::package', {}),
+ $service = hiera('adblockplus::puppet::master::service', {}),
+) {
+
+ include adblockplus
+ include puppetmaster
+ include stdlib
+
+ # https://forge.puppet.com/puppetlabs/stdlib#ensure_resource
+ ensure_resource('package', 'puppetmaster', $package)
f.lopez 2016/12/14 16:12:37 +1 for using ensure_resources instead of ensure_pa
+
+ # https://forge.puppet.com/puppetlabs/stdlib#getparam
+ if getparam(Package['puppet'], 'ensure') !~ /^(absent|purged)$/ {
+
+ ensure_resource('service', 'puppetmaster', merge({
+ 'ensure' => 'running',
+ 'hasrestart' => true,
+ 'hasstatus' => true,
+ }, $service))
+
+ Service['puppetmaster'] <- Package['puppetmaster']
+ }
+}
« no previous file with comments | « modules/adblockplus/manifests/puppet.pp ('k') | modules/private-stub/hiera/hosts.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld