|
42 | 42 | $elasticsearch::datadir: |
43 | 43 | ensure => 'directory', |
44 | 44 | group => $elasticsearch::elasticsearch_group, |
45 | | - owner => $elasticsearch::elasticsearch_user; |
| 45 | + owner => $elasticsearch::elasticsearch_user, |
| 46 | + mode => '2750'; |
46 | 47 | $elasticsearch::logdir: |
47 | 48 | ensure => 'directory', |
48 | 49 | group => $elasticsearch::elasticsearch_group, |
49 | 50 | owner => $elasticsearch::elasticsearch_user, |
50 | | - mode => '0750'; |
| 51 | + mode => '2750'; |
51 | 52 | $elasticsearch::real_plugindir: |
52 | 53 | ensure => 'directory', |
53 | 54 | group => $elasticsearch::elasticsearch_group, |
|
60 | 61 | recurse => true; |
61 | 62 | } |
62 | 63 |
|
63 | | - if $elasticsearch::pid_dir { |
64 | | - file { $elasticsearch::pid_dir: |
65 | | - ensure => 'directory', |
66 | | - group => undef, |
67 | | - owner => $elasticsearch::elasticsearch_user, |
68 | | - recurse => true, |
69 | | - } |
70 | | - |
71 | | - if ($elasticsearch::service_provider == 'systemd') { |
72 | | - $group = $elasticsearch::elasticsearch_group |
73 | | - $user = $elasticsearch::elasticsearch_user |
74 | | - $pid_dir = $elasticsearch::pid_dir |
75 | | - |
76 | | - file { '/usr/lib/tmpfiles.d/elasticsearch.conf': |
77 | | - ensure => 'file', |
78 | | - content => template("${module_name}/usr/lib/tmpfiles.d/elasticsearch.conf.erb"), |
79 | | - group => '0', |
80 | | - owner => 'root', |
81 | | - } |
82 | | - } |
83 | | - } |
84 | | - |
85 | | - if $elasticsearch::defaults_location { |
86 | | - augeas { "${elasticsearch::defaults_location}/elasticsearch": |
87 | | - incl => "${elasticsearch::defaults_location}/elasticsearch", |
88 | | - lens => 'Shellvars.lns', |
89 | | - changes => [ |
90 | | - 'rm CONF_FILE', |
91 | | - 'rm CONF_DIR', |
92 | | - 'rm ES_PATH_CONF', |
93 | | - ], |
94 | | - } |
95 | | - |
96 | | - file { "${elasticsearch::defaults_location}/elasticsearch": |
97 | | - ensure => 'file', |
98 | | - group => $elasticsearch::elasticsearch_group, |
99 | | - owner => $elasticsearch::elasticsearch_user, |
100 | | - mode => '0640'; |
101 | | - } |
102 | | - } |
103 | | - |
104 | 64 | # Defaults file, either from file source or from hash to augeas commands |
105 | 65 | if ($elasticsearch::init_defaults_file != undef) { |
106 | 66 | file { "${elasticsearch::defaults_location}/elasticsearch": |
107 | 67 | ensure => $elasticsearch::ensure, |
108 | 68 | source => $elasticsearch::init_defaults_file, |
109 | 69 | owner => 'root', |
110 | | - group => '0', |
111 | | - mode => '0644', |
| 70 | + group => $elasticsearch::elasticsearch_group, |
| 71 | + mode => '0660', |
112 | 72 | before => Service['elasticsearch'], |
113 | 73 | notify => $elasticsearch::_notify_service, |
114 | 74 | } |
115 | 75 | } else { |
116 | | - augeas { 'init_defaults': |
| 76 | + augeas { "${elasticsearch::defaults_location}/elasticsearch": |
117 | 77 | incl => "${elasticsearch::defaults_location}/elasticsearch", |
118 | 78 | lens => 'Shellvars.lns', |
119 | 79 | changes => template("${module_name}/etc/sysconfig/defaults.erb"), |
|
137 | 97 | $_keystore_path = $elasticsearch::keystore_path |
138 | 98 | } |
139 | 99 |
|
140 | | - $_tls_config = { |
141 | | - 'xpack.security.transport.ssl.enabled' => true, |
142 | | - 'xpack.security.http.ssl.enabled' => true, |
143 | | - 'xpack.ssl.keystore.path' => $_keystore_path, |
144 | | - 'xpack.ssl.keystore.password' => $elasticsearch::keystore_password, |
| 100 | + # Set the correct xpack. settings based on ES version |
| 101 | + if (versioncmp($elasticsearch::version, '7') >= 0) { |
| 102 | + $_tls_config = { |
| 103 | + 'xpack.security.http.ssl.enabled' => true, |
| 104 | + 'xpack.security.http.ssl.keystore.path' => $_keystore_path, |
| 105 | + 'xpack.security.http.ssl.keystore.password' => $elasticsearch::keystore_password, |
| 106 | + 'xpack.security.transport.ssl.enabled' => true, |
| 107 | + 'xpack.security.transport.ssl.keystore.path' => $_keystore_path, |
| 108 | + 'xpack.security.transport.ssl.keystore.password' => $elasticsearch::keystore_password, |
| 109 | + } |
| 110 | + } |
| 111 | + else { |
| 112 | + $_tls_config = { |
| 113 | + 'xpack.security.transport.ssl.enabled' => true, |
| 114 | + 'xpack.security.http.ssl.enabled' => true, |
| 115 | + 'xpack.ssl.keystore.path' => $_keystore_path, |
| 116 | + 'xpack.ssl.keystore.password' => $elasticsearch::keystore_password, |
| 117 | + } |
145 | 118 | } |
146 | 119 |
|
147 | 120 | # Trust CA Certificate |
|
0 commit comments