]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/elasticsearch/manifests/repo.pp
upgrade to elasticsearch/elasticsearch 0.9.6
[dsa-puppet.git] / 3rdparty / modules / elasticsearch / manifests / repo.pp
1 # == Class: elasticsearch::repo
2 #
3 # This class exists to install and manage yum and apt repositories
4 # that contain elasticsearch official elasticsearch packages
5 #
6 #
7 # === Parameters
8 #
9 # This class does not provide any parameters.
10 #
11 #
12 # === Examples
13 #
14 # This class may be imported by other classes to use its functionality:
15 #   class { 'elasticsearch::repo': }
16 #
17 # It is not intended to be used directly by external resources like node
18 # definitions or other modules.
19 #
20 #
21 # === Authors
22 #
23 # * Phil Fenstermacher <mailto:phillip.fenstermacher@gmail.com>
24 # * Richard Pijnenburg <mailto:richard.pijnenburg@elasticsearch.com>
25 #
26 class elasticsearch::repo {
27
28   Exec {
29     path      => [ '/bin', '/usr/bin', '/usr/local/bin' ],
30     cwd       => '/',
31   }
32
33   case $::osfamily {
34     'Debian': {
35       if !defined(Class['apt']) {
36         class { 'apt': }
37       }
38
39       apt::source { 'elasticsearch':
40         location    => "http://packages.elasticsearch.org/elasticsearch/${elasticsearch::repo_version}/debian",
41         release     => 'stable',
42         repos       => 'main',
43         key         => 'D88E42B4',
44         key_source  => 'http://packages.elasticsearch.org/GPG-KEY-elasticsearch',
45         include_src => false,
46       }
47     }
48     'RedHat', 'Linux': {
49       yumrepo { 'elasticsearch':
50         descr    => 'elasticsearch repo',
51         baseurl  => "http://packages.elasticsearch.org/elasticsearch/${elasticsearch::repo_version}/centos",
52         gpgcheck => 1,
53         gpgkey   => 'http://packages.elasticsearch.org/GPG-KEY-elasticsearch',
54         enabled  => 1,
55       }
56     }
57     'Suse': {
58       exec { 'elasticsearch_suse_import_gpg':
59         command => 'rpmkeys --import http://packages.elasticsearch.org/GPG-KEY-elasticsearch',
60         unless  => 'test $(rpm -qa gpg-pubkey | grep -i "D88E42B4" | wc -l) -eq 1 ',
61         notify  => [ Zypprepo['elasticsearch'] ],
62       }
63
64       zypprepo { 'elasticsearch':
65         baseurl     => "http://packages.elasticsearch.org/elasticsearch/${elasticsearch::repo_version}/centos",
66         enabled     => 1,
67         autorefresh => 1,
68         name        => 'elasticsearch',
69         gpgcheck    => 1,
70         gpgkey      => 'http://packages.elasticsearch.org/GPG-KEY-elasticsearch',
71         type        => 'yum',
72       }
73     }
74     default: {
75       fail("\"${module_name}\" provides no repository information for OSfamily \"${::osfamily}\"")
76     }
77   }
78
79   # Package pinning
80   if ($elasticsearch::package_pin == true and $elasticsearch::version != false) {
81     case $::osfamily {
82       'Debian': {
83         if !defined(Class['apt']) {
84           class { 'apt': }
85         }
86
87         apt::pin { $elasticsearch::package_name:
88           ensure   => 'present',
89           packages => $elasticsearch::package_name,
90           version  => $elasticsearch::version,
91           priority => 1000,
92         }
93       }
94       'RedHat', 'Linux': {
95
96         yum::versionlock { "0:elasticsearch-${elasticsearch::version}.noarch":
97           ensure => 'present',
98         }
99       }
100       default: {
101         fail("Unable to pin package for OSfamily \"${::osfamily}\"")
102       }
103     }
104   }
105
106 }