Add new module elasticsearch for listsearch
[mirror/dsa-puppet.git] / 3rdparty / modules / elasticsearch / manifests / ruby.pp
1 # == Define: elasticsearch::ruby
2 #
3 # there are many ruby bindings for elasticsearch. This provides all
4 # the ones we know about http://www.elasticsearch.org/guide/clients/
5 #
6 # === Parameters
7 #
8 # [*ensure*]
9 #   String. Controls if the managed resources shall be <tt>present</tt> or
10 #   <tt>absent</tt>. If set to <tt>absent</tt>:
11 #   * The managed software packages are being uninstalled.
12 #   * Any traces of the packages will be purged as good as possible. This may
13 #     include existing configuration files. The exact behavior is provider
14 #     dependent. Q.v.:
15 #     * Puppet type reference: {package, "purgeable"}[http://j.mp/xbxmNP]
16 #     * {Puppet's package provider source code}[http://j.mp/wtVCaL]
17 #   * System modifications (if any) will be reverted as good as possible
18 #     (e.g. removal of created users, services, changed log settings, ...).
19 #   * This is thus destructive and should be used with care.
20 #   Defaults to <tt>present</tt>.
21 #
22 # === Examples
23 #
24 # elasticsearch::ruby { 'elasticsearch':; }
25 #
26 # === Authors
27 #
28 # * Richard Pijnenburg <mailto:richard@ispavailability.com>
29 #
30 define elasticsearch::ruby (
31   $ensure = 'present'
32 ) {
33
34   if ! ($ensure in [ 'present', 'absent' ]) {
35     fail("\"${ensure}\" is not a valid ensure parameter value")
36   }
37
38   # make sure the package name is valid and setup the provider as
39   # necessary
40   case $name {
41     'tire': {
42       $provider = 'gem'
43     }
44     'stretcher': {
45       $provider = 'gem'
46     }
47     'elastic_searchable': {
48       $provider = 'gem'
49     }
50     'elasticsearch': {
51       $provider = 'gem'
52     }
53     'flex': {
54       $provider = 'gem'
55     }
56     default: {
57       fail("unknown ruby client package '${name}'")
58     }
59   }
60
61   package { "ruby_${name}":
62     ensure   => $ensure,
63     name     => $name,
64     provider => $provider,
65   }
66
67 }