Puppet Class: wazuh::opendistro
- Defined in:
- manifests/opendistro.pp
Overview
Wazuh App Copyright © 2021 Wazuh Inc. (License GPLv2) Setup for opendistro
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'manifests/opendistro.pp', line 3
class wazuh::opendistro (
# Elasticsearch.yml configuration
$opendistro_cluster_name = 'es-wazuh',
$opendistro_node_name = 'node-01',
$opendistro_node_master = true,
$opendistro_node_data = true,
$opendistro_node_ingest = true,
$opendistro_node_max_local_storage_nodes = '1',
$opendistro_service = 'elasticsearch',
$opendistro_package = 'opendistroforelasticsearch',
$opendistro_version = '1.13.2',
$opendistro_path_data = '/var/lib/elasticsearch',
$opendistro_path_logs = '/var/log/elasticsearch',
$opendistro_ip = 'localhost',
$opendistro_port = '9200',
$opendistro_discovery_option = 'discovery.type: single-node',
$opendistro_cluster_initial_master_nodes = "#cluster.initial_master_nodes: ['node-01']",
# JVM options
$jvm_options_memmory = '1g',
){
class {'wazuh::repo_opendistro':}
if $::osfamily == 'Debian' {
Class['wazuh::repo_opendistro'] -> Class['apt::update'] -> Package['opendistroforelasticsearch']
} else {
Class['wazuh::repo_opendistro'] -> Package['opendistroforelasticsearch']
}
# install package
package { 'opendistroforelasticsearch':
ensure => $opendistro_version,
name => $opendistro_package,
}
file { 'Configure elasticsearch.yml':
owner => 'elasticsearch',
path => '/etc/elasticsearch/elasticsearch.yml',
group => 'elasticsearch',
mode => '0644',
notify => Service[$opendistro_service], ## Restarts the service
content => template('wazuh/opendistro_yml.erb'),
require => Package[$opendistro_package],
}
file { 'Configure jvm.options':
owner => 'elasticsearch',
path => '/etc/elasticsearch/jvm.options',
group => 'elasticsearch',
mode => '0660',
notify => Service[$opendistro_service], ## Restarts the service
content => template('wazuh/jvm_options.erb'),
require => Package[$opendistro_package],
}
service { 'elasticsearch':
ensure => running,
enable => true,
require => Package[$opendistro_package],
}
exec { 'Insert line limits':
path => '/usr/bin:/bin/',
command => "echo 'elasticsearch - nofile 65535\nelasticsearch - memlock unlimited' >> /etc/security/limits.conf",
require => Package[$opendistro_package],
}
exec { 'Verify Elasticsearch folders owner':
path => '/usr/bin:/bin',
command => "chown elasticsearch:elasticsearch -R /etc/elasticsearch\
&& chown elasticsearch:elasticsearch -R /usr/share/elasticsearch\
&& chown elasticsearch:elasticsearch -R /var/lib/elasticsearch",
require => Package[$opendistro_package],
}
}
|