Puppet Class: elasticsearch::config
- Defined in:
- manifests/config.pp
Overview
Class: elasticsearch::config
This class exists to coordinate all configuration related actions, functionality and logical units in a central place.
Parameters
This class does not provide any parameters.
Examples
This class may be imported by other classes to use its functionality:
class { 'elasticsearch::config': }
It is not intended to be used directly by external resources like node definitions or other modules.
Authors
-
Richard Pijnenburg <richard.pijnenburg@elasticsearch.com>
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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'manifests/config.pp', line 25
class elasticsearch::config {
#### Configuration
Exec {
path => [ '/bin', '/usr/bin', '/usr/local/bin' ],
cwd => '/',
}
if ( $elasticsearch::ensure == 'present' ) {
file {
$elasticsearch::configdir:
ensure => 'directory',
group => $elasticsearch::elasticsearch_group,
owner => $elasticsearch::elasticsearch_user,
mode => '0644';
$elasticsearch::datadir:
ensure => 'directory',
group => $elasticsearch::elasticsearch_group,
owner => $elasticsearch::elasticsearch_user;
$elasticsearch::logdir:
ensure => 'directory',
group => undef,
owner => $elasticsearch::elasticsearch_user,
mode => '0644',
recurse => true;
$elasticsearch::plugindir:
ensure => 'directory',
group => $elasticsearch::elasticsearch_group,
owner => $elasticsearch::elasticsearch_user,
mode => 'o+Xr';
"${elasticsearch::homedir}/lib":
ensure => 'directory',
group => $elasticsearch::elasticsearch_group,
owner => $elasticsearch::elasticsearch_user,
recurse => true;
$elasticsearch::params::homedir:
ensure => 'directory',
group => $elasticsearch::elasticsearch_group,
owner => $elasticsearch::elasticsearch_user;
"${elasticsearch::params::homedir}/templates_import":
ensure => 'directory',
group => $elasticsearch::elasticsearch_group,
owner => $elasticsearch::elasticsearch_user,
mode => '0644';
"${elasticsearch::params::homedir}/scripts":
ensure => 'directory',
group => $elasticsearch::elasticsearch_group,
owner => $elasticsearch::elasticsearch_user,
mode => '0644';
"${elasticsearch::params::homedir}/shield":
ensure => 'directory',
mode => '0644',
group => '0',
owner => 'root';
'/etc/elasticsearch/elasticsearch.yml':
ensure => 'absent';
'/etc/elasticsearch/logging.yml':
ensure => 'absent';
'/etc/elasticsearch/log4j2.properties':
ensure => 'absent';
'/etc/init.d/elasticsearch':
ensure => 'absent';
}
if $elasticsearch::params::pid_dir {
file { $elasticsearch::params::pid_dir:
ensure => 'directory',
group => undef,
owner => $elasticsearch::elasticsearch_user,
recurse => true,
}
if ($elasticsearch::service_providers == 'systemd') {
$group = $elasticsearch::elasticsearch_group
$user = $elasticsearch::elasticsearch_user
$pid_dir = $elasticsearch::params::pid_dir
file { '/usr/lib/tmpfiles.d/elasticsearch.conf':
ensure => 'file',
content => template("${module_name}/usr/lib/tmpfiles.d/elasticsearch.conf.erb"),
group => '0',
owner => 'root',
}
}
}
if ($elasticsearch::service_providers == 'systemd') {
# Mask default unit (from package)
exec { 'systemctl mask elasticsearch.service':
unless => 'test `systemctl is-enabled elasticsearch.service` = masked',
}
}
$new_init_defaults = { 'CONF_DIR' => $elasticsearch::configdir }
if $elasticsearch::params::defaults_location {
augeas { "${elasticsearch::params::defaults_location}/elasticsearch":
incl => "${elasticsearch::params::defaults_location}/elasticsearch",
lens => 'Shellvars.lns',
changes => template("${module_name}/etc/sysconfig/defaults.erb"),
}
}
# Other OS than Linux may not have that sysctl
if $::kernel == 'Linux' {
sysctl { 'vm.max_map_count':
value => 262144,
}
}
} elsif ( $elasticsearch::ensure == 'absent' ) {
file { $elasticsearch::plugindir:
ensure => 'absent',
force => true,
backup => false,
}
}
}
|