Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 5cd46fd

Browse files
author
Dale McDiarmid
authored
Merge pull request #224 from gingerwizard/master
Version change and X-Pack Docs
2 parents a00f07e + e118e94 commit 5cd46fd

File tree

7 files changed

+104
-9
lines changed

7 files changed

+104
-9
lines changed

README.md

Lines changed: 98 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The use of a map ensures the Ansible playbook does not need to be updated to ref
4747

4848
In addition to the es_config map, several other parameters are supported for additional functions e.g. script installation. These can be found in the role's defaults/main.yml file.
4949

50-
The following illustrates applying configuration parameters to an Elasticsearch instance. By default, Elasticsearch 2.3.4 is installed.
50+
The following illustrates applying configuration parameters to an Elasticsearch instance. By default, Elasticsearch 2.4.3 is installed.
5151

5252
```
5353
- name: Elasticsearch with custom configuration
@@ -209,6 +209,99 @@ Then run it:
209209
ansible-playbook -i hosts ./your-playbook.yml
210210
```
211211

212+
### Installing X-Pack Features
213+
214+
X-Pack features, such as Shield, are supported for Elasticsearch 2.4 only. This feature is currently experimental. To enable X-Pack set the parameter `es_enable_xpack` to true and list the required features in the parameter `es_xpack_features`. The following additional parameters allow X-Pack to be configured:
215+
216+
* ```es_message_auth_file``` System Key field to allow message authentication. This file should be placed in the 'files' directory.
217+
* ```es_role_mapping``` Role mappings file declared as yml as described [here](https://www.elastic.co/guide/en/shield/current/mapping-roles.html)
218+
219+
```
220+
es_role_mapping:
221+
power_user:
222+
- "cn=admins,dc=example,dc=com"
223+
user:
224+
- "cn=users,dc=example,dc=com"
225+
- "cn=admins,dc=example,dc=com"
226+
```
227+
228+
* ```es_users``` - Users can be declared here as yml. Two sub keys 'native' and 'file' determine the realm under which realm the user is created. Beneath each of these keys users should be declared as yml entries. e.g.
229+
230+
```
231+
es_users:
232+
native:
233+
kibana4_server:
234+
password: changeMe
235+
roles:
236+
- kibana4_server
237+
file:
238+
es_admin:
239+
password: changeMe
240+
roles:
241+
- admin
242+
testUser:
243+
password: changeMeAlso!
244+
roles:
245+
- power_user
246+
- user
247+
```
248+
249+
250+
* ```es_roles``` - Elasticsearch roles can be declared here as yml. Two sub keys 'native' and 'file' determine how the role is created i.e. either through a file or http(native) call. Beneath each key list the roles with appropriate permissions, using the file based format described [here] (https://www.elastic.co/guide/en/shield/current/_file_based_roles.html) e.g.
251+
252+
```
253+
es_roles:
254+
file:
255+
admin:
256+
cluster:
257+
- all
258+
indices:
259+
- names: '*'
260+
privileges:
261+
- all
262+
power_user:
263+
cluster:
264+
- monitor
265+
indices:
266+
- names: '*'
267+
privileges:
268+
- all
269+
user:
270+
indices:
271+
- names: '*'
272+
privileges:
273+
- read
274+
kibana4_server:
275+
cluster:
276+
- monitor
277+
indices:
278+
- names: '.kibana'
279+
privileges:
280+
- all
281+
native:
282+
logstash:
283+
cluster:
284+
- manage_index_templates
285+
indices:
286+
- names: 'logstash-*'
287+
privileges:
288+
- write
289+
- delete
290+
- create_index
291+
```
292+
293+
* ```es_xpack_license``` - X-Pack license. The license should be declared as a json blob. Alternative use Ansible vault or copy the license to the target machine as part of a playbook and access via a lookup e.g.
294+
295+
```
296+
es_xpack_license: "{{ lookup('file', '/tmp/license.json') }}"
297+
```
298+
299+
X-Pack configuration parameters can be added to the elasticsearch.yml file using the normal `es_config` parameter.
300+
301+
For a full example see [here](https://github.com/elastic/ansible-elasticsearch/blob/master/test/integration/xpack.yml)
302+
303+
304+
212305
### Additional Configuration
213306

214307
Additional parameters to es_config allow the customization of the Java and Elasticsearch versions, in addition to role behaviour. Options include:
@@ -219,6 +312,8 @@ Following variables affect the versions installed:
219312
* ```es_version``` (e.g. "2.4.2").
220313
* ```es_api_host``` The host name used for actions requiring HTTP e.g. installing templates. Defaults to "localhost".
221314
* ```es_api_port``` The port used for actions requiring HTTP e.g. installing templates. Defaults to 9200.
315+
* ```es_api_basic_auth_username``` The Elasticsearch username for making admin changing actions. Used if Shield is enabled. Ensure this user is admin.
316+
* ```es_api_basic_auth_password``` The password associated with the user declared in `es_api_basic_auth_username`
222317
* ```es_start_service``` (true (default) or false)
223318
* ```es_plugins_reinstall``` (true or false (default) )
224319
* ```es_plugins``` an array of plugin definitions e.g.:
@@ -239,7 +334,7 @@ es_java_opts:
239334
Earlier examples illustrate the installation of plugins for 2.x. The correct use of this parameter varies depending on the version of Elasticsearch being installed:
240335

241336
- 2.x. - For officially supported plugins no version or source delimiter is required. The plugin script will determine the appropriate plugin version based on the target Elasticsearch version.
242-
For community based plugins include the full path e.g. "lmenezes/elasticsearch-kopf" and the appropriate version for the target version of Elasticsearch.
337+
For community based plugins include the full path e.g. "lmenezes/elasticsearch-kopf" and the appropriate version for the target version of Elasticsearch. This approach should NOT be used for X-Pack related plugins e.g. Shield. See X-Pack below for details here.
243338

244339
If installing Marvel or Watcher, ensure the license plugin is also specified. Shield configuration is currently not supported but planned for later versions.
245340

@@ -288,7 +383,7 @@ To define proxy only for a particular plugin during its installation:
288383
* The role assumes the user/group exists on the server. The elasticsearch packages create the default elasticsearch user. If this needs to be changed, ensure the user exists.
289384
* The playbook relies on the inventory_name of each host to ensure its directories are unique
290385
* Changing an instance_name for a role application will result in the installation of a new component. The previous component will remain.
291-
* KitchenCI has been used for testing. This is used to confirm images reach the correct state after a play is first applied. We currently test only the latest version of each major release i.e. 1.7.3 and 2.3.4 on
386+
* KitchenCI has been used for testing. This is used to confirm images reach the correct state after a play is first applied. We currently test only the latest version of 2.x on
292387
all supported platforms.
293388
* The role aims to be idempotent. Running the role multiple times, with no changes, should result in no state change on the server. If the configuration is changed, these will be applied and
294389
Elasticsearch restarted where required.

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
es_major_version: "2.x"
3-
es_version: "2.3.4"
3+
es_version: "2.4.3"
44
es_version_lock: false
55
es_use_repository: true
66
es_apt_key: "https://packages.elasticsearch.org/GPG-KEY-elasticsearch"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'config_spec'
22

33
describe 'Config Tests v 2.x' do
4-
include_examples 'config::init', "2.3.4"
4+
include_examples 'config::init', "2.4.3"
55
end
66

test/integration/multi-2x/serverspec/default_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
describe 'Multi Tests v 2.x' do
5-
include_examples 'multi::init', "2.3.4", ["kopf"]
5+
include_examples 'multi::init', "2.4.3", ["kopf"]
66
end
77

88

test/integration/package-2x/serverspec/default_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33

44
describe 'Package Tests v 2.x' do
5-
include_examples 'package::init', "2.3.4", ["kopf"]
5+
include_examples 'package::init', "2.4.3", ["kopf"]
66
end

test/integration/standard-2x/serverspec/default_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
describe 'Standard Tests v 2.x' do
5-
include_examples 'standard::init', "2.3.4"
5+
include_examples 'standard::init', "2.4.3"
66
end
77

88

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require 'xpack_spec'
22

33
describe 'Xpack Tests v 2.x' do
4-
include_examples 'xpack::init', "2.3.4"
4+
include_examples 'xpack::init', "2.4.3"
55
end

0 commit comments

Comments
 (0)