Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
97 lines (80 sloc) 3.09 KB
# == Class: boilerplate
#
# This class is able to install or remove boilerplate on a node.
#
# [Add description - What does this module do on a node?] FIXME/TODO
#
#
# === Parameters
#
# [*ensure*]
# String. Controls if the managed resources shall be <tt>present</tt> or
# <tt>absent</tt>. If set to <tt>absent</tt>:
# * The managed software packages are being uninstalled.
# * Any traces of the packages will be purged as good as possible. This may
# include existing configuration files. The exact behavior is provider
# dependent. Q.v.:
# * Puppet type reference: {package, "purgeable"}[http://j.mp/xbxmNP]
# * {Puppet's package provider source code}[http://j.mp/wtVCaL]
# * System modifications (if any) will be reverted as good as possible
# (e.g. removal of created users, services, changed log settings, ...).
# * This is thus destructive and should be used with care.
# Defaults to <tt>present</tt>.
#
# [*autoupgrade*]
# Boolean. If set to <tt>true</tt>, any managed package gets upgraded
# on each Puppet run when the package provider is able to find a newer
# version than the present one. The exact behavior is provider dependent.
# Q.v.:
# * Puppet type reference: {package, "upgradeable"}[http://j.mp/xbxmNP]
# * {Puppet's package provider source code}[http://j.mp/wtVCaL]
# Defaults to <tt>false</tt>.
#
# The default values for the parameters are set in boilerplate::params. Have
# a look at the corresponding <tt>params.pp</tt> manifest file if you need more
# technical information about them.
#
#
# === Examples
#
# * Installation:
# class { 'boilerplate': }
#
# * Removal/decommissioning:
# class { 'boilerplate':
# ensure => 'absent',
# }
#
#
# === Authors
#
# * John Doe <mailto:john.doe@example.com>
#
class boilerplate(
$ensure = $boilerplate::params::ensure,
$autoupgrade = $boilerplate::params::autoupgrade
) inherits boilerplate::params {
#### Validate parameters
# ensure
if ! ($ensure in [ 'present', 'absent' ]) {
fail("\"${ensure}\" is not a valid ensure parameter value")
}
# autoupgrade
validate_bool($autoupgrade)
#### Manage actions
# repository
class { 'boilerplate::repo': } # FIXME/TODO: Remove this declaration or this comment. See "repo.pp" for more information.
# package(s)
class { 'boilerplate::package': }
# configuration
class { 'boilerplate::config': } # FIXME/TODO: Remove this declaration or this comment. See "config.pp" for more information.
#### Manage relationships # FIXME/TODO: Remove the whole relationships block if not needed
if $ensure == 'present' {
# we need working repositories before installing packages
Class['boilerplate::repo'] -> Class['boilerplate::package'] # FIXME/TODO: Remove this relationship or this comment. See "repo.pp" for more information.
# we need the software before configuring it
Class['boilerplate::package'] -> Class['boilerplate::config'] # FIXME/TODO: Remove this relationship or this comment. See "config.pp" for more information.
} else {
# there is currently no need for a specific removal order
}
}