Permalink
Browse files

Update template for puppet classes/definition

Signed-off-by: Sebastien Varrette <Sebastien.Varrette@uni.lu>
  • Loading branch information...
Falkor committed Dec 8, 2011
1 parent 075cb81 commit 829003222a73efd806c99fb935b2dd625fb98e7a
Showing with 24 additions and 7 deletions.
  1. +24 −7 insert/insert.pp
View
@@ -3,15 +3,14 @@
# Copyright:: Copyright (c) %y %U (www[%o])
# License:: GPLv3
#
-# Time-stamp: < >
# ------------------------------------------------------------------------------
# = Class: %b
#
# %@
#
# == Parameters:
#
-# $param1 (Default: val):: description
+# $ensure:: *Default*: 'present'. Ensure the presence (or absence) of %b
#
# == Actions:
#
@@ -25,16 +24,29 @@
#
# import %b
#
+# You can then specialize the various aspects of the configuration,
+# for instance:
+#
+# class { '%b':
+# ensure => 'present'
+# }
+#
# == Warnings
#
# /!\ Always respect the style guide available
# here[http://docs.puppetlabs.com/guides/style_guide]
#
# [Remember: No empty lines between comments and class definition]
#
-class %b {
+class %b ( $ensure = $%b::params::ensure ) inherits %b::params {
- case $operatingsystem {
+ info ("Configuring %b (with ensure = ${ensure})")
+
+ if ! ($ensure in [ 'present', 'absent' ]) {
+ fail("%b 'ensure' parameter must be set to either 'absent' or 'present'")
+ }
+
+ case $::operatingsystem {
debian, ubuntu: { include %b::debian }
redhat, fedora, centos: { include %b::redhat }
default: {
@@ -48,22 +60,27 @@
#
# Base class to be inherited by the other %b classes
#
-# Note: respect the Naming standard provided here[http://projects.puppetlabs.com/projects/puppet/wiki/Module_Standards]
+# Note: respect the Naming standard provided
+# here[http://projects.puppetlabs.com/projects/puppet/wiki/Module_Standards]
class %b::common {
+ # Load the variables used in this module. Check the infiniband-params.pp file
+ require %b::params
+
+
}
# ------------------------------------------------------------------------------
# = Class: %b::debian
#
# Specialization class for Debian systems
-class %b::debian inherits %b::comon { }
+class %b::debian inherits %b::common { }
# ------------------------------------------------------------------------------
# = Class: %b::redhat
#
# Specialization class for Redhat systems
-class %b::redhat inherits %b::comon { }
+class %b::redhat inherits %b::common { }

0 comments on commit 8290032

Please sign in to comment.