Puppet Class: wazuh::repo_elastic
- Defined in:
- manifests/repo_elastic.pp
Overview
Wazuh App Copyright © 2019 Wazuh Inc. (License GPLv2) Installation of Elastic repository
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'manifests/repo_elastic.pp', line 3
class wazuh::repo_elastic (
) {
case $::osfamily {
'Debian' : {
if ! defined(Package['apt-transport-https']) {
ensure_packages(['apt-transport-https'], {'ensure' => 'present'})
}
# apt-key added by issue #34
apt::key { 'elastic':
id => '46095ACC8548582C1A2699A9D27D666CD88E42B4',
source => 'https://artifacts.elastic.co/GPG-KEY-elasticsearch',
}
case $::lsbdistcodename {
/(jessie|wheezy|stretch|sid|precise|trusty|vivid|wily|xenial|yakketi|bionic)/: {
apt::source { 'wazuh_elastic':
ensure => present,
comment => 'This is the Elastic repository',
location => 'https://artifacts.elastic.co/packages/7.x/apt',
release => 'stable',
repos => 'main',
include => {
'src' => false,
'deb' => true,
},
}
}
default: { fail('This ossec module has not been tested on your distribution (or lsb package not installed)') }
}
}
'Redhat' : {
case $::os[name] {
/^(CentOS|RedHat|OracleLinux|Fedora|Amazon)$/: {
if ( $::operatingsystemrelease =~ /^5.*/ ) {
$baseurl = 'https://artifacts.elastic.co/packages/7.x/yum'
$gpgkey = 'https://artifacts.elastic.co/GPG-KEY-elasticsearch'
} else {
$baseurl = 'https://artifacts.elastic.co/packages/7.x/yum'
$gpgkey = 'https://artifacts.elastic.co/GPG-KEY-elasticsearch'
}
}
default: { fail('This ossec module has not been tested on your distribution.') }
}
## Set up Elasticsearch repo
# Import GPG key
exec { 'Install Elasticsearch GPG key':
path => '/usr/bin',
command => 'rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch',
}
# Adding repo by Puppet yumrepo resource
yumrepo { 'elasticsearch':
ensure => 'present',
enabled => 1,
gpgcheck => 1,
gpgkey => $gpgkey,
baseurl => $baseurl,
name => 'elasticsearch',
}
}
default: { fail('This ossec module has not been tested on your distribution') }
}
}
|