falkorlib 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.Manifest.txt +15 -0
- data/.gitignore +11 -0
- data/.travis.yml +21 -0
- data/Gemfile.lock +1 -1
- data/binscripts/bootstrap.sh +47 -0
- data/falkorlib.gemspec +5 -5
- data/lib/falkorlib/version.rb +1 -1
- data/templates/puppet/modules/.gitignore +6 -0
- data/templates/puppet/modules/Gemfile +6 -0
- data/templates/puppet/modules/README.md.erb +87 -0
- data/templates/puppet/modules/Rakefile +28 -0
- data/templates/puppet/modules/doc/contributing.md.erb +140 -0
- data/templates/puppet/modules/files/README.md +21 -0
- data/templates/puppet/modules/manifests/classes/templatename-params.pp.erb +151 -0
- data/templates/puppet/modules/manifests/classes/templatename.pp.erb +197 -0
- data/templates/puppet/modules/manifests/definitions/templatename-mydef.pp.erb +111 -0
- data/templates/puppet/modules/manifests/init.pp.erb +11 -0
- data/templates/puppet/modules/metadata.json.erb +19 -0
- data/templates/puppet/modules/templates/README.md +24 -0
- data/templates/puppet/modules/templates/templatename-variables.erb +16 -0
- data/templates/puppet/modules/tests/init.pp.erb +12 -0
- metadata +19 -2
- data/.falkorlib.noespec +0 -321
@@ -0,0 +1,151 @@
|
|
1
|
+
# File:: <tt><%= config[:name] %>-params.pp</tt>
|
2
|
+
# Author:: <%= config[:author] %> (<%= config[:email] %>)
|
3
|
+
# Copyright:: Copyright (c) <%= Time.now.year %> <%= config[:author] %>
|
4
|
+
# License:: <%= config[:license] %>
|
5
|
+
#
|
6
|
+
# ------------------------------------------------------------------------------
|
7
|
+
# = Class: <%= config[:name] %>::params
|
8
|
+
#
|
9
|
+
# In this class are defined as variables values that are used in other
|
10
|
+
# <%= config[:name] %> classes.
|
11
|
+
# This class should be included, where necessary, and eventually be enhanced
|
12
|
+
# with support for more OS
|
13
|
+
#
|
14
|
+
# == Warnings
|
15
|
+
#
|
16
|
+
# /!\ Always respect the style guide available
|
17
|
+
# here[http://docs.puppetlabs.com/guides/style_guide]
|
18
|
+
#
|
19
|
+
# The usage of a dedicated param classe is advised to better deal with
|
20
|
+
# parametrized classes, see
|
21
|
+
# http://docs.puppetlabs.com/guides/parameterized_classes.html
|
22
|
+
#
|
23
|
+
# [Remember: No empty lines between comments and class definition]
|
24
|
+
#
|
25
|
+
class <%= config[:name] %>::params {
|
26
|
+
|
27
|
+
######## DEFAULTS FOR VARIABLES USERS CAN SET ##########################
|
28
|
+
# (Here are set the defaults, provide your custom variables externally)
|
29
|
+
# (The default used is in the line with '')
|
30
|
+
###########################################
|
31
|
+
|
32
|
+
# ensure the presence (or absence) of <%= config[:name] %>
|
33
|
+
$ensure = $<%= config[:name] %>_ensure ? {
|
34
|
+
'' => 'present',
|
35
|
+
default => "${<%= config[:name] %>_ensure}"
|
36
|
+
}
|
37
|
+
|
38
|
+
# The Protocol used. Used by monitor and firewall class. Default is 'tcp'
|
39
|
+
$protocol = $<%= config[:name] %>_protocol ? {
|
40
|
+
'' => 'tcp',
|
41
|
+
default => "${<%= config[:name] %>_protocol}",
|
42
|
+
}
|
43
|
+
# The port number. Used by monitor and firewall class. The default is 22.
|
44
|
+
$port = $<%= config[:name] %>_port ? {
|
45
|
+
'' => 22,
|
46
|
+
default => "${<%= config[:name] %>_port}",
|
47
|
+
}
|
48
|
+
# example of an array variable
|
49
|
+
$array_variable = $<%= config[:name] %>_array_variable ? {
|
50
|
+
'' => [],
|
51
|
+
default => $<%= config[:name] %>_array_variable,
|
52
|
+
}
|
53
|
+
|
54
|
+
|
55
|
+
#### MODULE INTERNAL VARIABLES #########
|
56
|
+
# (Modify to adapt to unsupported OSes)
|
57
|
+
#######################################
|
58
|
+
# <%= config[:name] %> packages
|
59
|
+
$packagename = $::operatingsystem ? {
|
60
|
+
default => '<%= config[:name] %>',
|
61
|
+
}
|
62
|
+
# $extra_packages = $::operatingsystem ? {
|
63
|
+
# /(?i-mx:ubuntu|debian)/ => [],
|
64
|
+
# /(?i-mx:centos|fedora|redhat)/ => [],
|
65
|
+
# default => []
|
66
|
+
# }
|
67
|
+
|
68
|
+
# Log directory
|
69
|
+
$logdir = $::operatingsystem ? {
|
70
|
+
default => '/var/log/<%= config[:name] %>'
|
71
|
+
}
|
72
|
+
$logdir_mode = $::operatingsystem ? {
|
73
|
+
default => '750',
|
74
|
+
}
|
75
|
+
$logdir_owner = $::operatingsystem ? {
|
76
|
+
default => 'root',
|
77
|
+
}
|
78
|
+
$logdir_group = $::operatingsystem ? {
|
79
|
+
default => 'adm',
|
80
|
+
}
|
81
|
+
|
82
|
+
# PID for daemons
|
83
|
+
# $piddir = $::operatingsystem ? {
|
84
|
+
# default => "/var/run/<%= config[:name] %>",
|
85
|
+
# }
|
86
|
+
# $piddir_mode = $::operatingsystem ? {
|
87
|
+
# default => '750',
|
88
|
+
# }
|
89
|
+
# $piddir_owner = $::operatingsystem ? {
|
90
|
+
# default => '<%= config[:name] %>',
|
91
|
+
# }
|
92
|
+
# $piddir_group = $::operatingsystem ? {
|
93
|
+
# default => 'adm',
|
94
|
+
# }
|
95
|
+
# $pidfile = $::operatingsystem ? {
|
96
|
+
# default => '/var/run/<%= config[:name] %>/<%= config[:name] %>.pid'
|
97
|
+
# }
|
98
|
+
|
99
|
+
# <%= config[:name] %> associated services
|
100
|
+
$servicename = $::operatingsystem ? {
|
101
|
+
/(?i-mx:ubuntu|debian)/ => '<%= config[:name] %>',
|
102
|
+
default => '<%= config[:name] %>'
|
103
|
+
}
|
104
|
+
# used for pattern in a service ressource
|
105
|
+
$processname = $::operatingsystem ? {
|
106
|
+
/(?i-mx:ubuntu|debian)/ => '<%= config[:name] %>',
|
107
|
+
default => '<%= config[:name] %>'
|
108
|
+
}
|
109
|
+
$hasstatus = $::operatingsystem ? {
|
110
|
+
/(?i-mx:ubuntu|debian)/ => false,
|
111
|
+
/(?i-mx:centos|fedora|redhat)/ => true,
|
112
|
+
default => true,
|
113
|
+
}
|
114
|
+
$hasrestart = $::operatingsystem ? {
|
115
|
+
default => true,
|
116
|
+
}
|
117
|
+
|
118
|
+
# Configuration directory & file
|
119
|
+
# $configdir = $::operatingsystem ? {
|
120
|
+
# default => "/etc/<%= config[:name] %>",
|
121
|
+
# }
|
122
|
+
# $configdir_mode = $::operatingsystem ? {
|
123
|
+
# default => '0755',
|
124
|
+
# }
|
125
|
+
# $configdir_owner = $::operatingsystem ? {
|
126
|
+
# default => 'root',
|
127
|
+
# }
|
128
|
+
# $configdir_group = $::operatingsystem ? {
|
129
|
+
# default => 'root',
|
130
|
+
# }
|
131
|
+
|
132
|
+
$configfile = $::operatingsystem ? {
|
133
|
+
default => '/etc/<%= config[:name] %>.conf',
|
134
|
+
}
|
135
|
+
$configfile_init = $::operatingsystem ? {
|
136
|
+
/(?i-mx:ubuntu|debian)/ => '/etc/default/<%= config[:name] %>',
|
137
|
+
default => '/etc/sysconfig/<%= config[:name] %>'
|
138
|
+
}
|
139
|
+
$configfile_mode = $::operatingsystem ? {
|
140
|
+
default => '0600',
|
141
|
+
}
|
142
|
+
$configfile_owner = $::operatingsystem ? {
|
143
|
+
default => 'root',
|
144
|
+
}
|
145
|
+
$configfile_group = $::operatingsystem ? {
|
146
|
+
default => 'root',
|
147
|
+
}
|
148
|
+
|
149
|
+
|
150
|
+
}
|
151
|
+
|
@@ -0,0 +1,197 @@
|
|
1
|
+
# File:: <tt><%= config[:name] %>.pp</tt>
|
2
|
+
# Author:: <%= config[:author] %> (<%= config[:email] %>)
|
3
|
+
# Copyright:: Copyright (c) <%= Time.now.year %> <%= config[:author] %>
|
4
|
+
# License:: <%= config[:license] %>
|
5
|
+
#
|
6
|
+
# ------------------------------------------------------------------------------
|
7
|
+
# = Class: <%= config[:name] %>
|
8
|
+
#
|
9
|
+
# <%= config[:summary] %>
|
10
|
+
#
|
11
|
+
# == Parameters:
|
12
|
+
#
|
13
|
+
# $ensure:: *Default*: 'present'. Ensure the presence (or absence) of <%= config[:name] %>
|
14
|
+
#
|
15
|
+
# == Actions:
|
16
|
+
#
|
17
|
+
# Install and configure <%= config[:name] %>
|
18
|
+
#
|
19
|
+
# == Requires:
|
20
|
+
#
|
21
|
+
# n/a
|
22
|
+
#
|
23
|
+
# == Sample Usage:
|
24
|
+
#
|
25
|
+
# import <%= config[:name] %>
|
26
|
+
#
|
27
|
+
# You can then specialize the various aspects of the configuration,
|
28
|
+
# for instance:
|
29
|
+
#
|
30
|
+
# class { '<%= config[:name] %>':
|
31
|
+
# ensure => 'present'
|
32
|
+
# }
|
33
|
+
#
|
34
|
+
# == Warnings
|
35
|
+
#
|
36
|
+
# /!\ Always respect the style guide available
|
37
|
+
# here[http://docs.puppetlabs.com/guides/style_guide]
|
38
|
+
#
|
39
|
+
#
|
40
|
+
# [Remember: No empty lines between comments and class definition]
|
41
|
+
#
|
42
|
+
class <%= config[:name] %>(
|
43
|
+
$ensure = $<%= config[:name] %>::params::ensure
|
44
|
+
)
|
45
|
+
inherits <%= config[:name] %>::params
|
46
|
+
{
|
47
|
+
info ("Configuring <%= config[:name] %> (with ensure = ${ensure})")
|
48
|
+
|
49
|
+
if ! ($ensure in [ 'present', 'absent' ]) {
|
50
|
+
fail("<%= config[:name] %> 'ensure' parameter must be set to either 'absent' or 'present'")
|
51
|
+
}
|
52
|
+
|
53
|
+
case $::operatingsystem {
|
54
|
+
debian, ubuntu: { include <%= config[:name] %>::debian }
|
55
|
+
redhat, fedora, centos: { include <%= config[:name] %>::redhat }
|
56
|
+
default: {
|
57
|
+
fail("Module $module_name is not supported on $operatingsystem")
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
# ------------------------------------------------------------------------------
|
63
|
+
# = Class: <%= config[:name] %>::common
|
64
|
+
#
|
65
|
+
# Base class to be inherited by the other <%= config[:name] %> classes
|
66
|
+
#
|
67
|
+
# Note: respect the Naming standard provided here[http://projects.puppetlabs.com/projects/puppet/wiki/Module_Standards]
|
68
|
+
class <%= config[:name] %>::common {
|
69
|
+
|
70
|
+
# Load the variables used in this module. Check the <%= config[:name] %>-params.pp file
|
71
|
+
require <%= config[:name] %>::params
|
72
|
+
|
73
|
+
package { '<%= config[:name] %>':
|
74
|
+
name => "${<%= config[:name] %>::params::packagename}",
|
75
|
+
ensure => "${<%= config[:name] %>::ensure}",
|
76
|
+
}
|
77
|
+
# package { $<%= config[:name] %>::params::extra_packages:
|
78
|
+
# ensure => 'present'
|
79
|
+
# }
|
80
|
+
|
81
|
+
if $<%= config[:name] %>::ensure == 'present' {
|
82
|
+
|
83
|
+
# Prepare the log directory
|
84
|
+
file { "${<%= config[:name] %>::params::logdir}":
|
85
|
+
ensure => 'directory',
|
86
|
+
owner => "${<%= config[:name] %>::params::logdir_owner}",
|
87
|
+
group => "${<%= config[:name] %>::params::logdir_group}",
|
88
|
+
mode => "${<%= config[:name] %>::params::logdir_mode}",
|
89
|
+
require => Package['<%= config[:name] %>'],
|
90
|
+
}
|
91
|
+
|
92
|
+
# Configuration file
|
93
|
+
# file { "${<%= config[:name] %>::params::configdir}":
|
94
|
+
# ensure => 'directory',
|
95
|
+
# owner => "${<%= config[:name] %>::params::configdir_owner}",
|
96
|
+
# group => "${<%= config[:name] %>::params::configdir_group}",
|
97
|
+
# mode => "${<%= config[:name] %>::params::configdir_mode}",
|
98
|
+
# require => Package['<%= config[:name] %>'],
|
99
|
+
# }
|
100
|
+
# Regular version using file resource
|
101
|
+
file { '<%= config[:name] %>.conf':
|
102
|
+
path => "${<%= config[:name] %>::params::configfile}",
|
103
|
+
owner => "${<%= config[:name] %>::params::configfile_owner}",
|
104
|
+
group => "${<%= config[:name] %>::params::configfile_group}",
|
105
|
+
mode => "${<%= config[:name] %>::params::configfile_mode}",
|
106
|
+
ensure => "${<%= config[:name] %>::ensure}",
|
107
|
+
#content => template("<%= config[:name] %>/<%= config[:name] %>conf.erb"),
|
108
|
+
#source => "puppet:///modules/<%= config[:name] %>/<%= config[:name] %>.conf",
|
109
|
+
#notify => Service['<%= config[:name] %>'],
|
110
|
+
require => [
|
111
|
+
#File["${<%= config[:name] %>::params::configdir}"],
|
112
|
+
Package['<%= config[:name] %>']
|
113
|
+
],
|
114
|
+
}
|
115
|
+
|
116
|
+
# # Concat version
|
117
|
+
# include concat::setup
|
118
|
+
# concat { "${<%= config[:name] %>::params::configfile}":
|
119
|
+
# warn => false,
|
120
|
+
# owner => "${<%= config[:name] %>::params::configfile_owner}",
|
121
|
+
# group => "${<%= config[:name] %>::params::configfile_group}",
|
122
|
+
# mode => "${<%= config[:name] %>::params::configfile_mode}",
|
123
|
+
# #notify => Service['<%= config[:name] %>'],
|
124
|
+
# require => Package['<%= config[:name] %>'],
|
125
|
+
# }
|
126
|
+
# # Populate the configuration file
|
127
|
+
# concat::fragment { "${<%= config[:name] %>::params::configfile}_header":
|
128
|
+
# target => "${<%= config[:name] %>::params::configfile}",
|
129
|
+
# ensure => "${<%= config[:name] %>::ensure}",
|
130
|
+
# content => template("<%= config[:name] %>/<%= config[:name] %>_header.conf.erb"),
|
131
|
+
# #source => "puppet:///modules/<%= config[:name] %>/<%= config[:name] %>_header.conf",
|
132
|
+
# order => '01',
|
133
|
+
# }
|
134
|
+
# concat::fragment { "${<%= config[:name] %>::params::configfile}_footer":
|
135
|
+
# target => "${<%= config[:name] %>::params::configfile}",
|
136
|
+
# ensure => "${<%= config[:name] %>::ensure}",
|
137
|
+
# content => template("<%= config[:name] %>/<%= config[:name] %>_footer.conf.erb"),
|
138
|
+
# #source => "puppet:///modules/<%= config[:name] %>/<%= config[:name] %>_footer.conf",
|
139
|
+
# order => '99',
|
140
|
+
# }
|
141
|
+
|
142
|
+
# PID file directory
|
143
|
+
# file { "${<%= config[:name] %>::params::piddir}":
|
144
|
+
# ensure => 'directory',
|
145
|
+
# owner => "${<%= config[:name] %>::params::piddir_user}",
|
146
|
+
# group => "${<%= config[:name] %>::params::piddir_group}",
|
147
|
+
# mode => "${<%= config[:name] %>::params::piddir_mode}",
|
148
|
+
# }
|
149
|
+
|
150
|
+
file { "${<%= config[:name] %>::params::configfile_init}":
|
151
|
+
owner => "${<%= config[:name] %>::params::configfile_owner}",
|
152
|
+
group => "${<%= config[:name] %>::params::configfile_group}",
|
153
|
+
mode => "${<%= config[:name] %>::params::configfile_mode}",
|
154
|
+
ensure => "${<%= config[:name] %>::ensure}",
|
155
|
+
#content => template("<%= config[:name] %>/default/<%= config[:name] %>.erb"),
|
156
|
+
#source => "puppet:///modules/<%= config[:name] %>/default/<%= config[:name] %>.conf",
|
157
|
+
notify => Service['<%= config[:name] %>'],
|
158
|
+
require => Package['<%= config[:name] %>']
|
159
|
+
}
|
160
|
+
|
161
|
+
service { '<%= config[:name] %>':
|
162
|
+
name => "${<%= config[:name] %>::params::servicename}",
|
163
|
+
enable => true,
|
164
|
+
ensure => running,
|
165
|
+
hasrestart => "${<%= config[:name] %>::params::hasrestart}",
|
166
|
+
pattern => "${<%= config[:name] %>::params::processname}",
|
167
|
+
hasstatus => "${<%= config[:name] %>::params::hasstatus}",
|
168
|
+
require => [
|
169
|
+
Package['<%= config[:name] %>'],
|
170
|
+
File["${<%= config[:name] %>::params::configfile_init}"]
|
171
|
+
],
|
172
|
+
subscribe => File['<%= config[:name] %>.conf'],
|
173
|
+
}
|
174
|
+
}
|
175
|
+
else
|
176
|
+
{
|
177
|
+
# Here $<%= config[:name] %>::ensure is 'absent'
|
178
|
+
|
179
|
+
}
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
|
184
|
+
# ------------------------------------------------------------------------------
|
185
|
+
# = Class: <%= config[:name] %>::debian
|
186
|
+
#
|
187
|
+
# Specialization class for Debian systems
|
188
|
+
class <%= config[:name] %>::debian inherits <%= config[:name] %>::common { }
|
189
|
+
|
190
|
+
# ------------------------------------------------------------------------------
|
191
|
+
# = Class: <%= config[:name] %>::redhat
|
192
|
+
#
|
193
|
+
# Specialization class for Redhat systems
|
194
|
+
class <%= config[:name] %>::redhat inherits <%= config[:name] %>::common { }
|
195
|
+
|
196
|
+
|
197
|
+
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# File:: <tt><%= config[:name] %>-mydef.pp</tt>
|
2
|
+
# Author:: <%= config[:author] %> (<%= config[:email] %>)
|
3
|
+
# Copyright:: Copyright (c) <%= Time.now.year %> <%= config[:author] %>
|
4
|
+
# License:: <%= config[:license] %>
|
5
|
+
#
|
6
|
+
# ------------------------------------------------------------------------------
|
7
|
+
# = Defines: <%= config[:name] %>::mydef
|
8
|
+
#
|
9
|
+
# <%= config[:summary] %>
|
10
|
+
#
|
11
|
+
# == Pre-requisites
|
12
|
+
#
|
13
|
+
# * The class '<%= config[:name] %>' should have been instanciated
|
14
|
+
#
|
15
|
+
# == Parameters:
|
16
|
+
#
|
17
|
+
# [*ensure*]
|
18
|
+
# default to 'present', can be 'absent'.
|
19
|
+
# Default: 'present'
|
20
|
+
#
|
21
|
+
# [*content*]
|
22
|
+
# Specify the contents of the mydef entry as a string. Newlines, tabs,
|
23
|
+
# and spaces can be specified using the escaped syntax (e.g., \n for a newline)
|
24
|
+
#
|
25
|
+
# [*source*]
|
26
|
+
# Copy a file as the content of the mydef entry.
|
27
|
+
# Uses checksum to determine when a file should be copied.
|
28
|
+
# Valid values are either fully qualified paths to files, or URIs. Currently
|
29
|
+
# supported URI types are puppet and file.
|
30
|
+
# In neither the 'source' or 'content' parameter is specified, then the
|
31
|
+
# following parameters can be used to set the console entry.
|
32
|
+
#
|
33
|
+
# == Sample usage:
|
34
|
+
#
|
35
|
+
# include "<%= config[:name] %>"
|
36
|
+
#
|
37
|
+
# You can then add a mydef specification as follows:
|
38
|
+
#
|
39
|
+
# <%= config[:name] %>::mydef {
|
40
|
+
#
|
41
|
+
# }
|
42
|
+
#
|
43
|
+
# == Warnings
|
44
|
+
#
|
45
|
+
# /!\ Always respect the style guide available
|
46
|
+
# here[http://docs.puppetlabs.com/guides/style_guide]
|
47
|
+
#
|
48
|
+
# [Remember: No empty lines between comments and class definition]
|
49
|
+
#
|
50
|
+
define <%= config[:name] %>::mydef(
|
51
|
+
$ensure = 'present',
|
52
|
+
$content = '',
|
53
|
+
$source = ''
|
54
|
+
)
|
55
|
+
{
|
56
|
+
include <%= config[:name] %>::params
|
57
|
+
|
58
|
+
# $name is provided at define invocation
|
59
|
+
$basename = $name
|
60
|
+
|
61
|
+
if ! ($ensure in [ 'present', 'absent' ]) {
|
62
|
+
fail("<%= config[:name] %>::mydef 'ensure' parameter must be set to either 'absent' or 'present'")
|
63
|
+
}
|
64
|
+
|
65
|
+
if ($<%= config[:name] %>::ensure != $ensure) {
|
66
|
+
if ($<%= config[:name] %>::ensure != 'present') {
|
67
|
+
fail("Cannot configure a <%= config[:name] %> '${basename}' as <%= config[:name] %>::ensure is NOT set to present (but ${<%= config[:name] %>::ensure})")
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
# if content is passed, use that, else if source is passed use that
|
72
|
+
$real_content = $content ? {
|
73
|
+
'' => $source ? {
|
74
|
+
'' => template('<%= config[:name] %>/<%= config[:name] %>_entry.erb'),
|
75
|
+
default => ''
|
76
|
+
},
|
77
|
+
default => $content
|
78
|
+
}
|
79
|
+
$real_source = $source ? {
|
80
|
+
'' => '',
|
81
|
+
default => $content ? {
|
82
|
+
'' => $source,
|
83
|
+
default => ''
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
# concat::fragment { "${<%= config[:name] %>::params::configfile}_${basename}":
|
88
|
+
# target => "${<%= config[:name] %>::params::configfile}",
|
89
|
+
# ensure => "${ensure}",
|
90
|
+
# content => $real_content,
|
91
|
+
# source => $real_source,
|
92
|
+
# order => '50',
|
93
|
+
# }
|
94
|
+
|
95
|
+
# case $ensure {
|
96
|
+
# present: {
|
97
|
+
|
98
|
+
# }
|
99
|
+
# absent: {
|
100
|
+
|
101
|
+
# }
|
102
|
+
# disabled: {
|
103
|
+
|
104
|
+
# }
|
105
|
+
# default: { err ( "Unknown ensure value: '${ensure}'" ) }
|
106
|
+
# }
|
107
|
+
|
108
|
+
}
|
109
|
+
|
110
|
+
|
111
|
+
|