falkorlib 0.3.10 → 0.3.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4e94c1089995299cfd1bfaa76cdc3637d5f3f22
4
- data.tar.gz: fafd75148f4a2c45e26140f55168d88689fb46f6
3
+ metadata.gz: b66fad570393a3c8d53f22fbb4707c4f67ed3671
4
+ data.tar.gz: 1ee0a06e03794039cb1dd099fe1963ea2157e733
5
5
  SHA512:
6
- metadata.gz: 0b71d5459bd221b73367900c5010537cb685f6612dbb3bf6beb0db9ecff39d43bd4f51c4b63dd55512e9accd3ce6ad5e1710aca3b6dac2231d293c0070888574
7
- data.tar.gz: 965e09a164c35e08a3a8f70e7b62a319defb69ff0e47532d5bb04ebe65236f2d01db8f73f3c61d84ff19b6cbd48260c69981d9e29581c0e0d29cc2a2a83a92ae
6
+ metadata.gz: 9cc1fbce19391077964b63ed36130a1ef1936475a12835294a6e27e68dc6f545ebe766abc2051749e6ca09e56083c053a702c138084db793340e5d05c99ab872
7
+ data.tar.gz: 19e995415b29a6dfaec0525c30c8b7d6a78e57aa8f96ebb3da8856ba60f17861ead2a08bceedd13235ccb43dc7479d4656916dfea6e9e09ecae6baa5a1f46aff
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- falkorlib (0.3.10)
4
+ falkorlib (0.3.11)
5
5
  awesome_print (~> 1.2)
6
6
  configatron (~> 3.2)
7
7
  diffy (>= 3.0)
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Ven 2014-09-05 10:50 svarrette>
3
+ # Time-stamp: <Sam 2014-09-06 16:21 svarrette>
4
4
  ################################################################################
5
5
  # Interface for the main Puppet Module operations
6
6
  #
@@ -112,7 +112,7 @@ module FalkorLib #:nodoc:
112
112
  end
113
113
  config[k.to_sym] = ask( "\t" + sprintf("%-20s", "Module #{k}"), default_answer)
114
114
  end
115
- name = config[:name].gsub(/.*-/, '')
115
+ config[:shortname] = name = config[:name].gsub(/.*-/, '')
116
116
  tags = ask("\tKeywords (comma-separated list of tags)", name)
117
117
  config[:tags] = tags.split(',')
118
118
  list_license = FalkorLib::Config::Puppet::Modules::DEFAULTS[:licenses]
@@ -126,7 +126,10 @@ module FalkorLib #:nodoc:
126
126
 
127
127
  # Supported platforms
128
128
  config[:platforms] = [ 'debian' ]
129
-
129
+ config[:dependencies] = [{
130
+ "name" => "puppetlabs-stdlib",
131
+ "version_range" => ">= 1.0.0"
132
+ }]
130
133
  #ap config
131
134
  # Bootstrap the directory
132
135
  templatedir = File.join( FalkorLib.templates, 'puppet', 'modules')
@@ -163,7 +166,9 @@ module FalkorLib #:nodoc:
163
166
  info "=> preparing git-flow feature for the newly created module '#{config[:name]}'"
164
167
  FalkorLib::GitFlow.start('feature', "bootstraping", moduledir)
165
168
  end
166
- [ 'metadata.json', 'doc/', 'LICENSE', '.gitignore', 'Gemfile', 'Rakefile'].each do |f|
169
+ [ 'metadata.json',
170
+ 'doc/', 'LICENSE', '.gitignore',
171
+ 'Gemfile', '.vagrant_init.rb', 'Rakefile', 'Vagrantfile' ].each do |f|
167
172
  FalkorLib::Git.add(File.join(moduledir, f))
168
173
  end
169
174
  end
@@ -247,7 +252,7 @@ module FalkorLib #:nodoc:
247
252
  metadata[:operatingsystem_support].each do |e|
248
253
  metadata[:platforms] << e["operatingsystem"].downcase
249
254
  end
250
-
255
+ metadata[:shortname] = name.gsub(/.*-/, '')
251
256
  [ 'README.md', 'doc/contributing.md'].each do |f|
252
257
  info "Upgrade the content of #{f}"
253
258
  ans = options[:no_interaction] ? 'Yes' : ask("procceed?", 'Yes')
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
3
  # puppet_modules.rake - Special tasks for the management of Puppet modules
4
- # Time-stamp: <Lun 2014-09-01 16:38 svarrette>
4
+ # Time-stamp: <Ven 2014-09-05 22:27 svarrette>
5
5
  #
6
6
  # Copyright (c) 2014 Sebastien Varrette <Sebastien.Varrette@uni.lu>
7
7
  # http://varrette.gforge.uni.lu
@@ -65,19 +65,28 @@ namespace :puppet do
65
65
  FalkorLib::Puppet::Modules.parse()
66
66
  end # task parse
67
67
 
68
- ########### puppet:module:validate ###########
69
- desc "Validate manifests, templates, and ruby files"
70
- task :validate do
71
- Dir['manifests/**/*.pp'].each do |manifest|
72
- sh "puppet parser validate --noop #{manifest}"
73
- end
74
- Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
75
- sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
76
- end
77
- Dir['templates/**/*.erb'].each do |template|
78
- sh "erb -P -x -T '-' #{template} | ruby -c"
79
- end
80
- end
68
+ ########### puppet:module:check ###########
69
+ desc "Check the syntax and programming style of the module"
70
+ task :check => [
71
+ :syntax,
72
+ :lint
73
+ ]
74
+ # do
75
+ # info "validate parsing"
76
+ # Dir['manifests/**/*.pp'].each do |manifest|
77
+ # sh "puppet parser validate --noop #{manifest}"
78
+ # end
79
+ # Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
80
+ # sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
81
+ # end
82
+ # Dir['templates/**/*.erb'].each do |template|
83
+ # sh "erb -P -x -T '-' #{template} | ruby -c"
84
+ # end
85
+ # info "checking style guidelines with puppet-lint"
86
+ # Rake::Task[:lint].invoke
87
+ # info "checking syntax"
88
+ # Rake::Task[:syntax].invoke
89
+ # end
81
90
 
82
91
  ########### puppet:module:classes ###########
83
92
  desc "Parse the module for classes definitions"
@@ -119,6 +128,43 @@ namespace :templates do
119
128
  end # namespace upgrade
120
129
  end # namespace module
121
130
 
131
+
132
+ #.....................
133
+ require 'rake/clean'
134
+ CLEAN.add 'pkg'
135
+
136
+ exclude_tests_paths = ['pkg/**/*','spec/**/*']
137
+
138
+ #.........................................................................
139
+ # puppet-lint tasks -- see http://puppet-lint.com/checks/
140
+ #
141
+ require 'puppet-lint/tasks/puppet-lint'
142
+
143
+ PuppetLint.configuration.send('disable_autoloader_layout')
144
+ PuppetLint.configuration.send('disable_class_inherits_from_params_class')
145
+ PuppetLint.configuration.send('disable_80chars')
146
+ PuppetLint.configuration.ignore_paths = exclude_tests_paths
147
+
148
+ task :lint_info do
149
+ info "checking style guidelines with puppet-lint"
150
+ end
151
+ task :lint => :lint_info
152
+
153
+ #.........................................................................
154
+ # Puppet-syntax - see https://github.com/gds-operations/puppet-syntax
155
+ #
156
+ require 'puppet-syntax/tasks/puppet-syntax'
157
+ PuppetSyntax.future_parser = true
158
+ PuppetSyntax.exclude_paths = exclude_tests_paths
159
+
160
+ task :syntax_info do
161
+ info "checking syntax for Puppet manifests, templates, and Hiera YAML"
162
+ end
163
+ task :syntax => :syntax_info
164
+
165
+
166
+ ################################################
167
+
122
168
  [ 'major', 'minor', 'patch' ].each do |level|
123
169
  task "version:bump:#{level}" => 'puppet:module:validate'
124
170
  end
@@ -32,7 +32,7 @@ begin
32
32
  # Glob pattern to match files.
33
33
  #t.pattern = "spec/**/common_*.rb"
34
34
  #t.pattern = "spec/**/versioning_*spec.rb"
35
- #t.pattern = "spec/**/puppet*spec.rb"
35
+ t.pattern = "spec/**/puppet*spec.rb"
36
36
 
37
37
  # Whether or not to fail Rake when an error occurs (typically when
38
38
  # examples fail).
@@ -19,7 +19,7 @@ module FalkorLib #:nodoc:
19
19
  # MAJOR: Defines the major version
20
20
  # MINOR: Defines the minor version
21
21
  # PATCH: Defines the patch version
22
- MAJOR, MINOR, PATCH = 0, 3, 10
22
+ MAJOR, MINOR, PATCH = 0, 3, 11
23
23
 
24
24
  module_function
25
25
 
@@ -2,7 +2,7 @@
2
2
  #########################################
3
3
  # puppet_modules_spec.rb
4
4
  # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
5
- # Time-stamp: <Ven 2014-09-05 10:52 svarrette>
5
+ # Time-stamp: <Sam 2014-09-06 16:25 svarrette>
6
6
  #
7
7
  # @description Check the Puppet Modules operations
8
8
  #
@@ -117,7 +117,7 @@ describe FalkorLib::Puppet::Modules do
117
117
  end
118
118
 
119
119
  it "#deps -- should find a new dependency" do
120
- classfile = File.join(moduledir, 'manifests', 'classes', 'toto.pp')
120
+ classfile = File.join(moduledir, 'manifests', 'init.pp')
121
121
  newdep = "tata"
122
122
  run %{ echo 'include "#{newdep}"' >> #{classfile} }
123
123
  a = FalkorLib::Puppet::Modules.deps(moduledir)
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ ##########################################################################
3
+ # vagrant_init.rb
4
+ # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
5
+ # Time-stamp: <Ven 2014-09-05 11:39 svarrette>
6
+ #
7
+ # @description
8
+ #
9
+ # Copyright (c) 2014 Sebastien Varrette <Sebastien.Varrette@uni.lu>
10
+ # . http://varrette.gforge.uni.lu
11
+ ##############################################################################
12
+
13
+ require 'json'
14
+ require 'falkorlib'
15
+
16
+ include FalkorLib::Common
17
+
18
+ # Load metadata
19
+ basedir = File.directory?('/vagrant') ? '/vagrant' : Dir.pwd
20
+ jsonfile = File.join( basedir, 'metadata.json')
21
+
22
+ error "Unable to find the metadata.json" unless File.exists?(jsonfile)
23
+
24
+ metadata = JSON.parse( IO.read( jsonfile ) )
25
+ name = metadata["name"].gsub(/^[^\/-]+[\/-]/,'')
26
+ metadata["dependencies"].each do |dep|
27
+ lib = dep["name"]
28
+ run %{ puppet module install #{lib} }
29
+ end
30
+
31
+ modulepath=`puppet config print modulepath`.chomp
32
+ moduledir=modulepath.split(':').first
33
+
34
+ puts "#{modulepath}"
35
+ puts "#{moduledir}"
36
+
37
+ info "set symlink to the '#{modulepath} module for loca developments"
38
+ run %{ ln -s #{basedir} #{moduledir}/#{name} } unless File.exists?("#{moduledir}/#{name}")
@@ -1,6 +1,12 @@
1
1
  # A sample Gemfile
2
2
  source "https://rubygems.org"
3
3
 
4
- # gem "rails"
5
4
  gem 'falkorlib' #, :path => '~/git/github.com/Falkor/falkorlib'
6
- gem "puppet"
5
+
6
+ # Puppet stuff
7
+ puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 3.3']
8
+ gem "puppet", puppetversion
9
+ gem 'puppetlabs_spec_helper', '>= 0.1.0'
10
+ gem 'puppet-lint', '>= 0.3.2'
11
+ gem 'puppet-syntax'
12
+ gem 'facter', '>= 1.7.0'
@@ -1,6 +1,6 @@
1
1
  -*- mode: markdown; mode: auto-fill; fill-column: 80 -*-
2
2
 
3
- # <%= config[:name].gsub(/.*-/, '').capitalize %> Puppet Module
3
+ # <%= config[:shortname].capitalize %> Puppet Module
4
4
 
5
5
  [![Puppet Forge](http://img.shields.io/puppetforge/v/<%= config[:name].gsub(/-/,"/") %>.svg)](<%= config[:forge_url] %>)
6
6
  [![License](http://img.shields.io/:license-<%= config[:license].gsub(/-/, '') %>-blue.svg)](LICENSE)
@@ -18,52 +18,67 @@
18
18
 
19
19
  <%= config[:description] %>
20
20
 
21
+ This module implements the following elements:
22
+
23
+ * __classes__: `<%= config[:shortname] %>`
24
+ * __definitions__:
25
+ * `<%= config[:shortname] %>::mydef`:
26
+
21
27
  The various operations of this repository are piloted from a `Rakefile` which
22
28
  assumes that you have [RVM](https://rvm.io/) installed on your system.
23
29
 
24
30
  ## Dependencies
25
31
 
26
- See `metadata.json`.
32
+ See [`metadata.json`](metadata.json). In particular, this module depends on
27
33
 
28
- ## <%= config[:name].gsub(/.*-/, '') %> class parameters
34
+ <% config[:dependencies].each do |dep| %>
35
+ * [<%= dep["name"].gsub(/-/,"/") %>](https://forge.puppetlabs.com/<%= dep["name"].gsub(/-/,"/") %>)
36
+ <% end %>
29
37
 
30
- * `$ensure` [Default: 'present']: Ensure <%= config[:name].gsub(/^puppet-/,'')
31
- %> is present, absent etc.
38
+ ## General Parameters
32
39
 
33
- ## Usage
40
+ See [manifests/params.pp](manifests/params.pp)
34
41
 
35
- ### class <%= config[:name].gsub(/.*-/, '') %>
42
+ ## Overview and Usage
36
43
 
37
- include '<%= config[:name].gsub(/.*-/,'') %>'
44
+ ### class `<%= config[:shortname] %>`
38
45
 
46
+ include ' <%= config[:shortname] %>'
39
47
 
40
- ## Documentation
48
+ ### definition `<%= config[:shortname] %>::mydef`
41
49
 
42
- Please refer to the header of each manifest files to understand the usage of
43
- classes and definitions associated to the '<%= config[:name] %>' module.
44
-
45
- Alternatively, generate automatically the documentation via
46
- [`puppet doc`](http://docs.puppetlabs.com/man/doc.html) as follows:
50
+ The definition `<%= config[:shortname] %>::mydef` provides ...
51
+ This definition accepts the following parameters:
52
+
53
+ * `$ensure`: default to 'present', can be 'absent'
54
+ * `$content`: specify the contents of the directive as a string
55
+ * `$source`: copy a file as the content of the directive.
56
+
57
+ Example:
47
58
 
48
- $> rake doc # Not yet implemented
49
-
50
- For other information, please refer to the `metadata.json` file in this directory
59
+ <%= config[:shortname] %>::mydef {'entry':
60
+ content => "entry\n",
61
+ }
51
62
 
52
63
  ## Librarian-Puppet / R10K Setup
53
64
 
54
- You can of course configure <%= config[:name] %> in your `Puppetfile` to make it
65
+ You can of course configure ULHPC-sudo in your `Puppetfile` to make it
55
66
  available with [Librarian puppet](http://librarian-puppet.com/) or
56
67
  [r10k](https://github.com/adrienthebo/r10k) by adding the following entry:
57
68
 
58
- mod <%= config[:name] %>,
69
+ # Modules from the Puppet Forge
70
+ mod "<%= config[:name] %>"
71
+
72
+ or, if you prefer to work on the git version:
73
+
74
+ mod "<%= config[:name] %>",
59
75
  :git => <%= config[:source] %>,
60
76
  :ref => <%= FalkorLib.config[:gitflow][:branches][:master] %>
61
77
 
62
-
63
78
  ## Issues / Feature request
64
79
 
65
80
  You can submit bug / issues / feature request using the
66
- [<%= config[:name] %> Tracker](<%= config[:issues_url] %>).
81
+ [<%= config[:name] %> Puppet Module Tracker](<%= config[:issues_url] %>).
67
82
 
68
83
 
69
84
  ## Developments / Contributing to the code
@@ -75,6 +90,40 @@ These elements are detailed on [`doc/contributing.md`](doc/contributing.md)
75
90
  You are more than welcome to contribute to its development by
76
91
  [sending a pull request](https://help.github.com/articles/using-pull-requests).
77
92
 
93
+ ## Tests on Vagrant box
94
+
95
+ The best way to test this module in a non-intrusive way is to rely on
96
+ [Vagrant](http://www.vagrantup.com/). The `Vagrantfile` at the root of the
97
+ repository pilot the provisioning of the vagrant box and relies on boxes
98
+ generated through my [vagrant-vms](https://github.com/falkor/vagrant-vms)
99
+ repository.
100
+ Once cloned, run
101
+
102
+ $> rake packer:Debian:init
103
+
104
+ To create a template. Select the version matching the once mentioned on the
105
+ `Vagrantfile` (`7.6.0-amd64` for instance)
106
+ Then run
107
+
108
+ $> rake packer:Debian:build
109
+
110
+ This shall generate the vagrant box `debian-7.6.0-amd64.box` that you can then
111
+ add to your box lists:
112
+
113
+ $> vagrant box add debian-7.6.0-amd64 packer/debian-7.6.0-amd64/debian-7.6.0-amd64.box
114
+
115
+ Now you can run `vagrant up` from this repository to boot the VM, provision it
116
+ to be ready to test this module (see the [`.vagrant_init.rb`](.vagrant_init.rb)
117
+ script). For instance, you can test the manifests of the `tests/` directory
118
+ within the VM:
119
+
120
+ $> vagrant ssh
121
+ [...]
122
+ (vagrant)$> sudo puppet apply -t /vagrant/tests/init.pp
123
+
124
+ Run `vagrant halt` (or `vagrant destroy`) to stop (or kill) the VM once you've
125
+ finished to play with it.
126
+
78
127
  ## Resources
79
128
 
80
129
  ### Git
@@ -26,6 +26,3 @@ require 'falkorlib/tasks/puppet'
26
26
  ##############################################################################
27
27
  #TOP_SRCDIR = File.expand_path(File.join(File.dirname(__FILE__), "."))
28
28
 
29
- require 'rake/clean'
30
-
31
- CLEAN.add 'pkg'
@@ -0,0 +1,71 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5
+ VAGRANTFILE_API_VERSION = "2"
6
+
7
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8
+ # All Vagrant configuration is done here. The most common configuration
9
+ # options are documented and commented below. For a complete reference,
10
+ # please see the online documentation at vagrantup.com.
11
+
12
+ # Every Vagrant virtual environment requires a box to build off of.
13
+ config.vm.box = "debian-7.6.0-amd64"
14
+
15
+ # Disable automatic box update checking. If you disable this, then
16
+ # boxes will only be checked for updates when the user runs
17
+ # `vagrant box outdated`. This is not recommended.
18
+ # config.vm.box_check_update = false
19
+
20
+ # Create a forwarded port mapping which allows access to a specific port
21
+ # within the machine from a port on the host machine. In the example below,
22
+ # accessing "localhost:8080" will access port 80 on the guest machine.
23
+ # config.vm.network "forwarded_port", guest: 80, host: 8080
24
+
25
+ # Create a private network, which allows host-only access to the machine
26
+ # using a specific IP.
27
+ # config.vm.network "private_network", ip: "192.168.33.10"
28
+
29
+ # Create a public network, which generally matched to bridged network.
30
+ # Bridged networks make the machine appear as another physical device on
31
+ # your network.
32
+ # config.vm.network "public_network"
33
+
34
+ # If true, then any SSH connections made will enable agent forwarding.
35
+ # Default value: false
36
+ # config.ssh.forward_agent = true
37
+
38
+ # Share an additional folder to the guest VM. The first argument is
39
+ # the path on the host to the actual folder. The second argument is
40
+ # the path on the guest to mount the folder. And the optional third
41
+ # argument is a set of non-required options.
42
+ # config.vm.synced_folder "../data", "/vagrant_data"
43
+
44
+ # Provider-specific configuration so you can fine-tune various
45
+ # backing providers for Vagrant. These expose provider-specific options.
46
+ # Example for VirtualBox:
47
+ #
48
+ # config.vm.provider "virtualbox" do |vb|
49
+ # # Don't boot with headless mode
50
+ # vb.gui = true
51
+ #
52
+ # # Use VBoxManage to customize the VM. For example to change memory:
53
+ # vb.customize ["modifyvm", :id, "--memory", "1024"]
54
+ # end
55
+ #
56
+ # View the documentation for the provider you're using for more
57
+ # information on available options.
58
+
59
+ # Enable provisioning with Puppet stand alone. Puppet manifests
60
+ # are contained in a directory path relative to this Vagrantfile.
61
+ # You will need to create the manifests directory and a manifest in
62
+ # the file default.pp in the manifests_path directory.
63
+ #
64
+ # config.vm.provision "puppet" do |puppet|
65
+ # puppet.manifests_path = "manifests"
66
+ # puppet.manifest_file = "site.pp"
67
+ # end
68
+
69
+ # Enable provisioning with shell scripts
70
+ config.vm.provision "shell", path: ".vagrant_init.rb"
71
+ end
@@ -1,11 +1,197 @@
1
- # File:: init.pp
1
+ # File:: <tt>init.pp</tt>
2
2
  # Author:: <%= config[:author] %> (<%= config[:mail] %>)
3
3
  # Copyright:: Copyright (c) <%= Time.now.year %> <%= config[:author] %>
4
- # License:: <%= config[:license] %>
4
+ # License:: <%= config[:license].capitalize %>
5
5
  #
6
6
  # ------------------------------------------------------------------------------
7
+ # = Class: <%= config[:shortname] %>
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 { }
7
195
 
8
- import "classes/*.pp"
9
- #import "definitions/*.pp"
10
196
 
11
197
 
@@ -1,16 +1,16 @@
1
- # File:: <tt><%= config[:name] %>-mydef.pp</tt>
1
+ # File:: <tt>mydef.pp</tt>
2
2
  # Author:: <%= config[:author] %> (<%= config[:mail] %>)
3
3
  # Copyright:: Copyright (c) <%= Time.now.year %> <%= config[:author] %>
4
- # License:: <%= config[:license] %>
4
+ # License:: <%= config[:license].capitalize %>
5
5
  #
6
6
  # ------------------------------------------------------------------------------
7
- # = Defines: <%= config[:name] %>::mydef
7
+ # = Defines: <%= config[:shortname] %>::mydef
8
8
  #
9
9
  # <%= config[:summary] %>
10
10
  #
11
11
  # == Pre-requisites
12
12
  #
13
- # * The class '<%= config[:name] %>' should have been instanciated
13
+ # * The class '<%= config[:shortname] %>' should have been instanciated
14
14
  #
15
15
  # == Parameters:
16
16
  #
@@ -32,11 +32,11 @@
32
32
  #
33
33
  # == Sample usage:
34
34
  #
35
- # include "<%= config[:name] %>"
35
+ # include "<%= config[:shortname] %>"
36
36
  #
37
37
  # You can then add a mydef specification as follows:
38
38
  #
39
- # <%= config[:name] %>::mydef {
39
+ # <%= config[:shortname] %>::mydef {
40
40
  #
41
41
  # }
42
42
  #
@@ -47,31 +47,31 @@
47
47
  #
48
48
  # [Remember: No empty lines between comments and class definition]
49
49
  #
50
- define <%= config[:name] %>::mydef(
50
+ define <%= config[:shortname] %>::mydef(
51
51
  $ensure = 'present',
52
52
  $content = '',
53
53
  $source = ''
54
54
  )
55
55
  {
56
- include <%= config[:name] %>::params
56
+ include <%= config[:shortname] %>::params
57
57
 
58
58
  # $name is provided at define invocation
59
59
  $basename = $name
60
60
 
61
61
  if ! ($ensure in [ 'present', 'absent' ]) {
62
- fail("<%= config[:name] %>::mydef 'ensure' parameter must be set to either 'absent' or 'present'")
62
+ fail("<%= config[:shortname] %>::mydef 'ensure' parameter must be set to either 'absent' or 'present'")
63
63
  }
64
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})")
65
+ if ($<%= config[:shortname] %>::ensure != $ensure) {
66
+ if ($<%= config[:shortname] %>::ensure != 'present') {
67
+ fail("Cannot configure a <%= config[:shortname] %> '${basename}' as <%= config[:shortname] %>::ensure is NOT set to present (but ${<%= config[:shortname] %>::ensure})")
68
68
  }
69
69
  }
70
70
 
71
71
  # if content is passed, use that, else if source is passed use that
72
72
  $real_content = $content ? {
73
73
  '' => $source ? {
74
- '' => template('<%= config[:name] %>/<%= config[:name] %>_entry.erb'),
74
+ '' => template('<%= config[:shortname] %>/<%= config[:shortname] %>_entry.erb'),
75
75
  default => ''
76
76
  },
77
77
  default => $content
@@ -84,9 +84,9 @@ define <%= config[:name] %>::mydef(
84
84
  }
85
85
  }
86
86
 
87
- # concat::fragment { "${<%= config[:name] %>::params::configfile}_${basename}":
88
- # target => "${<%= config[:name] %>::params::configfile}",
87
+ # concat::fragment { "${<%= config[:shortname] %>::params::configfile}_${basename}":
89
88
  # ensure => "${ensure}",
89
+ # target => "${<%= config[:shortname] %>::params::configfile}",
90
90
  # content => $real_content,
91
91
  # source => $real_source,
92
92
  # order => '50',
@@ -1,13 +1,13 @@
1
- # File:: <tt><%= config[:name] %>-params.pp</tt>
1
+ # File:: <tt>params.pp</tt>
2
2
  # Author:: <%= config[:author] %> (<%= config[:mail] %>)
3
3
  # Copyright:: Copyright (c) <%= Time.now.year %> <%= config[:author] %>
4
- # License:: <%= config[:license] %>
4
+ # License:: <%= config[:license].capitalize %>
5
5
  #
6
6
  # ------------------------------------------------------------------------------
7
- # = Class: <%= config[:name] %>::params
7
+ # = Class: <%= config[:shortname] %>::params
8
8
  #
9
9
  # In this class are defined as variables values that are used in other
10
- # <%= config[:name] %> classes.
10
+ # <%= config[:shortname] %> classes.
11
11
  # This class should be included, where necessary, and eventually be enhanced
12
12
  # with support for more OS
13
13
  #
@@ -22,42 +22,42 @@
22
22
  #
23
23
  # [Remember: No empty lines between comments and class definition]
24
24
  #
25
- class <%= config[:name] %>::params {
25
+ class <%= config[:shortname] %>::params {
26
26
 
27
27
  ######## DEFAULTS FOR VARIABLES USERS CAN SET ##########################
28
28
  # (Here are set the defaults, provide your custom variables externally)
29
29
  # (The default used is in the line with '')
30
30
  ###########################################
31
31
 
32
- # ensure the presence (or absence) of <%= config[:name] %>
33
- $ensure = $<%= config[:name] %>_ensure ? {
32
+ # ensure the presence (or absence) of <%= config[:shortname] %>
33
+ $ensure = $<%= config[:shortname] %>_ensure ? {
34
34
  '' => 'present',
35
- default => "${<%= config[:name] %>_ensure}"
35
+ default => "${<%= config[:shortname] %>_ensure}"
36
36
  }
37
37
 
38
38
  # The Protocol used. Used by monitor and firewall class. Default is 'tcp'
39
- $protocol = $<%= config[:name] %>_protocol ? {
39
+ $protocol = $<%= config[:shortname] %>_protocol ? {
40
40
  '' => 'tcp',
41
- default => "${<%= config[:name] %>_protocol}",
41
+ default => "${<%= config[:shortname] %>_protocol}",
42
42
  }
43
43
  # The port number. Used by monitor and firewall class. The default is 22.
44
- $port = $<%= config[:name] %>_port ? {
44
+ $port = $<%= config[:shortname] %>_port ? {
45
45
  '' => 22,
46
- default => "${<%= config[:name] %>_port}",
46
+ default => "${<%= config[:shortname] %>_port}",
47
47
  }
48
48
  # example of an array variable
49
- $array_variable = $<%= config[:name] %>_array_variable ? {
49
+ $array_variable = $<%= config[:shortname] %>_array_variable ? {
50
50
  '' => [],
51
- default => $<%= config[:name] %>_array_variable,
51
+ default => $<%= config[:shortname] %>_array_variable,
52
52
  }
53
53
 
54
54
 
55
55
  #### MODULE INTERNAL VARIABLES #########
56
56
  # (Modify to adapt to unsupported OSes)
57
57
  #######################################
58
- # <%= config[:name] %> packages
58
+ # <%= config[:shortname] %> packages
59
59
  $packagename = $::operatingsystem ? {
60
- default => '<%= config[:name] %>',
60
+ default => '<%= config[:shortname] %>',
61
61
  }
62
62
  # $extra_packages = $::operatingsystem ? {
63
63
  # /(?i-mx:ubuntu|debian)/ => [],
@@ -67,7 +67,7 @@ class <%= config[:name] %>::params {
67
67
 
68
68
  # Log directory
69
69
  $logdir = $::operatingsystem ? {
70
- default => '/var/log/<%= config[:name] %>'
70
+ default => '/var/log/<%= config[:shortname] %>'
71
71
  }
72
72
  $logdir_mode = $::operatingsystem ? {
73
73
  default => '750',
@@ -81,30 +81,30 @@ class <%= config[:name] %>::params {
81
81
 
82
82
  # PID for daemons
83
83
  # $piddir = $::operatingsystem ? {
84
- # default => "/var/run/<%= config[:name] %>",
84
+ # default => "/var/run/<%= config[:shortname] %>",
85
85
  # }
86
86
  # $piddir_mode = $::operatingsystem ? {
87
87
  # default => '750',
88
88
  # }
89
89
  # $piddir_owner = $::operatingsystem ? {
90
- # default => '<%= config[:name] %>',
90
+ # default => '<%= config[:shortname] %>',
91
91
  # }
92
92
  # $piddir_group = $::operatingsystem ? {
93
93
  # default => 'adm',
94
94
  # }
95
95
  # $pidfile = $::operatingsystem ? {
96
- # default => '/var/run/<%= config[:name] %>/<%= config[:name] %>.pid'
96
+ # default => '/var/run/<%= config[:shortname] %>/<%= config[:shortname] %>.pid'
97
97
  # }
98
98
 
99
- # <%= config[:name] %> associated services
99
+ # <%= config[:shortname] %> associated services
100
100
  $servicename = $::operatingsystem ? {
101
- /(?i-mx:ubuntu|debian)/ => '<%= config[:name] %>',
102
- default => '<%= config[:name] %>'
101
+ /(?i-mx:ubuntu|debian)/ => '<%= config[:shortname] %>',
102
+ default => '<%= config[:shortname] %>'
103
103
  }
104
104
  # used for pattern in a service ressource
105
105
  $processname = $::operatingsystem ? {
106
- /(?i-mx:ubuntu|debian)/ => '<%= config[:name] %>',
107
- default => '<%= config[:name] %>'
106
+ /(?i-mx:ubuntu|debian)/ => '<%= config[:shortname] %>',
107
+ default => '<%= config[:shortname] %>'
108
108
  }
109
109
  $hasstatus = $::operatingsystem ? {
110
110
  /(?i-mx:ubuntu|debian)/ => false,
@@ -117,7 +117,7 @@ class <%= config[:name] %>::params {
117
117
 
118
118
  # Configuration directory & file
119
119
  # $configdir = $::operatingsystem ? {
120
- # default => "/etc/<%= config[:name] %>",
120
+ # default => "/etc/<%= config[:shortname] %>",
121
121
  # }
122
122
  # $configdir_mode = $::operatingsystem ? {
123
123
  # default => '0755',
@@ -130,11 +130,11 @@ class <%= config[:name] %>::params {
130
130
  # }
131
131
 
132
132
  $configfile = $::operatingsystem ? {
133
- default => '/etc/<%= config[:name] %>.conf',
133
+ default => '/etc/<%= config[:shortname] %>.conf',
134
134
  }
135
135
  $configfile_init = $::operatingsystem ? {
136
- /(?i-mx:ubuntu|debian)/ => '/etc/default/<%= config[:name] %>',
137
- default => '/etc/sysconfig/<%= config[:name] %>'
136
+ /(?i-mx:ubuntu|debian)/ => '/etc/default/<%= config[:shortname] %>',
137
+ default => '/etc/sysconfig/<%= config[:shortname] %>'
138
138
  }
139
139
  $configfile_mode = $::operatingsystem ? {
140
140
  default => '0600',
@@ -9,4 +9,12 @@
9
9
  # Learn more about module testing here:
10
10
  # http://docs.puppetlabs.com/guides/tests_smoke.html
11
11
  #
12
- include <%= config[:name] %>
12
+ #
13
+ #
14
+ # You can execute this manifest as follows in your vagrant box:
15
+ #
16
+ # sudo puppet apply -t /vagrant/tests/init.pp
17
+ #
18
+ node default {
19
+ include <%= config[:shortname] %>
20
+ }
@@ -0,0 +1,41 @@
1
+ # File:: <tt>params.pp</tt>
2
+ # Author:: <%= config[:author] %> (<%= config[:mail] %>)
3
+ # Copyright:: Copyright (c) <%= Time.now.year %> <%= config[:author] %>
4
+ # License:: <%= config[:license].capitalize %>
5
+ #
6
+ # ------------------------------------------------------------------------------
7
+ # You need the 'future' parser to be able to execute this manifest (that's
8
+ # required for the each loop below).
9
+ #
10
+ # Thus execute this manifest in your vagrant box as follows:
11
+ #
12
+ # sudo puppet apply -t --parser future /vagrant/tests/params.pp
13
+ #
14
+ #
15
+
16
+ include '<%= config[:shortname] %>::params'
17
+
18
+ $names = [
19
+ "ensure",
20
+ "protocol",
21
+ "port",
22
+ "packagename",
23
+ "logdir",
24
+ "logdir_mode",
25
+ "logdir_owner",
26
+ "logdir_group",
27
+ "servicename",
28
+ "processname",
29
+ "hasstatus",
30
+ "hasrestart",
31
+ "configfile",
32
+ "configfile_init",
33
+ "configfile_mode",
34
+ "configfile_owner",
35
+ "configfile_group",
36
+ ]
37
+
38
+ each($names) |$v| {
39
+ $var = "<%= config[:shortname] %>::params::${v}"
40
+ notice("${var} = ", inline_template('<%%= scope.lookupvar(@var) %>'))
41
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falkorlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastien Varrette
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-05 00:00:00.000000000 Z
11
+ date: 2014-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -320,19 +320,21 @@ files:
320
320
  - spec/falkorlib_spec.rb
321
321
  - spec/spec_helper.rb
322
322
  - templates/puppet/modules/.gitignore
323
+ - templates/puppet/modules/.vagrant_init.rb
323
324
  - templates/puppet/modules/Gemfile
324
325
  - templates/puppet/modules/README.md.erb
325
326
  - templates/puppet/modules/Rakefile
327
+ - templates/puppet/modules/Vagrantfile
326
328
  - templates/puppet/modules/doc/contributing.md.erb
327
329
  - templates/puppet/modules/files/README.md.erb
328
- - templates/puppet/modules/manifests/classes/templatename-params.pp.erb
329
- - templates/puppet/modules/manifests/classes/templatename.pp.erb
330
- - templates/puppet/modules/manifests/definitions/templatename-mydef.pp.erb
331
330
  - templates/puppet/modules/manifests/init.pp.erb
331
+ - templates/puppet/modules/manifests/mydef.pp.erb
332
+ - templates/puppet/modules/manifests/params.pp.erb
332
333
  - templates/puppet/modules/metadata.json.erb
333
334
  - templates/puppet/modules/templates/README.md.erb
334
335
  - templates/puppet/modules/templates/templatename-variables.erb
335
336
  - templates/puppet/modules/tests/init.pp.erb
337
+ - templates/puppet/modules/tests/params.pp.erb
336
338
  homepage: https://github.com/Falkor/falkorlib
337
339
  licenses:
338
340
  - MIT
@@ -1,197 +0,0 @@
1
- # File:: <tt><%= config[:name] %>.pp</tt>
2
- # Author:: <%= config[:author] %> (<%= config[:mail] %>)
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
-