-
Notifications
You must be signed in to change notification settings - Fork 3
/
init.pp
96 lines (80 loc) · 3.09 KB
/
init.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# == 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
}
}