Add new module elasticsearch for listsearch
[mirror/dsa-puppet.git] / 3rdparty / modules / elasticsearch / manifests / python.pp
1 # == Define: elasticsearch::python
2 #
3 # there are many python 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::python { 'pyes':; }
25 #
26 # === Authors
27 #
28 # * Richard Pijnenburg <mailto:richard.pijnenburg@elasticsearch.com>
29 #
30 define elasticsearch::python (
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     'pyes': {
42       $provider = 'pip'
43     }
44     'rawes': {
45       $provider = 'pip'
46     }
47     'pyelasticsearch': {
48       $provider = 'pip'
49     }
50     'ESClient': {
51       $provider = 'pip'
52     }
53     'elasticutils': {
54       $provider = 'pip'
55     }
56     'elasticsearch': {
57       $provider = 'pip'
58     }
59     default: {
60       fail("unknown python binding package '${name}'")
61     }
62   }
63
64   package { "python_${name}":
65     ensure   => $ensure,
66     name     => $name,
67     provider => $provider,
68   }
69
70 }