Skip to content

Commit 02aa2c6

Browse files
authored
Merge branch 'main' into feature-singlenode-8
2 parents 240537d + b920d29 commit 02aa2c6

File tree

18 files changed

+42
-10
lines changed

18 files changed

+42
-10
lines changed

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,23 @@ collections:
2727
- name: netways.elasticstack
2828
```
2929

30+
### Requirements
31+
32+
You will need the following Ansible collections installed
33+
34+
* community.general (probably already present)
35+
36+
You may want the following Ansible roles installed. There other ways to achieve what they are doing but using them is easy and convenient.
37+
38+
* geerlingguy.redis
39+
3040
## Usage
3141

3242
Our default configuration will collect filesystem logs placed by `rsyslog`. Therefor our example playbook makes sure, `rsyslog` is installed. If you don't want that, please change the configuration of the `beats` module. Without syslog you won't receive any messages with the default configuration.
3343

3444
There are some comments in the Playbook. Either fill them with the correct values (`remote_user`) or consider them as a hint to commonly used options.
45+
46+
The execution order of the roles is important! (see below)
3547
```
3648
---
3749
- hosts: all

docs/role-elasticsearch.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Role Variables
1717
* *elasticsearch_create_datapath*: Create the path for data to store if it doesn't exist. (default: `false` - only useful if you change `elasticsearch_datapath`)
1818
* *elasticsearch_fs_repo*: List of paths that should be registered as repository for snapshots (only filesystem supported so far). (default: none) Remember, that every node needs access to the same share under the same path.
1919
* *elasticsearch_disable_systemcallfilterchecks*: Disable system call filter checks. This has a security impact but is necessary on some systems. Please refer to the [docs](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/_system_call_filter_check.html) for details. (default: `false`)
20+
* *elasticsearch_pamlimits*: Set pam_limits neccessary for Elasticsearch. (Default: `true`)
2021

2122
This variable activates a workaround to start on systems that have certain hardening measures active. See [Stackoverflow](https://stackoverflow.com/questions/47824643/unable-to-load-jna-native-support-library-elasticsearch-6-x/50371992#50371992) for details and logmessages to look for. **WARNING**: This will change your `/etc/sysconfig/elasticseach`or `/etc/default/elasticsearch` file and overwrite `ES_JAVA_OPTS`. See this [issue](https://github.com/NETWAYS/ansible-role-elasticsearch/issues/79) for details.
2223

galaxy.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ tags:
2121
- metricbeat
2222
- filebeat
2323
- monitoring
24-
dependencies: {}
24+
dependencies:
25+
"community.general": "*"
2526
repository: https://github.com/NETWAYS/ansible-collection-elasticstack
2627
documentation: https://github.com/NETWAYS/ansible-collection-elasticstack/README.md
2728
homepage: https://www.netways.de
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
collections:
3+
- community.general
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
collections:
3+
- community.general
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
collections:
3+
- community.general
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
collections:
3+
- community.general
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
collections:
3+
- community.general

molecule/kibana_full_stack-oss/prepare.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- gpg
99
- curl
1010
- procps
11+
- gpg-agent
1112
update_cache: yes
1213
when: ansible_os_family == "Debian"
1314
- name: Install git

molecule/kibana_full_stack/prepare.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- gpg
99
- curl
1010
- procps
11+
- gpg-agent
1112
update_cache: yes
1213
when: ansible_os_family == "Debian"
1314
- name: Install git

requirements-test.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ ansible
22
ansible-lint
33
molecule
44
molecule-docker
5+
pytest

roles/elasticsearch/defaults/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ elasticsearch_datapath: /var/lib/elasticsearch
1313
elasticsearch_create_datapath: false
1414
elasticsearch_disable_systemcallfilterchecks: false
1515
elasticsearch_heap: "{{ [[ ( ansible_memtotal_mb // 1024) // 2 , 30 ]|min, 1]|max }}"
16+
elasticsearch_pamlimits: true
1617

1718
elasticsearch_jna_workaround: false
1819

roles/elasticsearch/tasks/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
domain: elasticsearch
2727
value: 65535
2828
limit_type: hard
29+
when:
30+
- elasticsearch_pamlimits | bool
2931

3032
- name: Ensure Elasticsearch is installed
3133
package:

roles/elasticsearch/tests/inventory

-2
This file was deleted.

roles/elasticsearch/tests/test.yml

-5
This file was deleted.

roles/kibana/tasks/kibana-security.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585

8686
- name: fetch Kibana password
8787
shell: >
88-
grep "PASSWORD kibana " /usr/share/elasticsearch/initial_passwords |
88+
grep "PASSWORD kibana_system " /usr/share/elasticsearch/initial_passwords |
8989
awk {' print $4 '}
9090
register: kibana_password
9191
changed_when: false

roles/kibana/templates/kibana.yml.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ server.host: "0.0.0.0"
22

33
{% if elastic_stack_full_stack is defined and elastic_stack_full_stack | bool and kibana_security | bool and elastic_variant == "elastic" %}
44
elasticsearch.hosts: [{% for host in kibana_elasticsearch_hosts %}"https://{{ host }}:9200"{% if not loop.last %},{% endif %}{% endfor %}]
5-
elasticsearch.username: "kibana"
5+
elasticsearch.username: "kibana_system"
66
elasticsearch.password: "{{ kibana_password.stdout }}"
77
elasticsearch.ssl.certificateAuthorities: "/etc/kibana/certs/ca.crt"
88
{% if "localhost" in kibana_elasticsearch_hosts %}elasticsearch.ssl.verificationMode: certificate

roles/logstash/tasks/logstash-security.yml

+4
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@
231231
-u elastic:{{ elastic_password_logstash.stdout }}
232232
https://{{ elasticsearch_ca }}:9200/_xpack/security/role/logstash_writer
233233
delegate_to: "{{ elasticsearch_ca }}"
234+
changed_when: false
234235
run_once: true
235236
when:
236237
- logstash_writer_role_present.rc > 0 or logstash_reset_writer_role | bool
@@ -243,6 +244,7 @@
243244
-u elastic:{{ elastic_password_logstash.stdout }}
244245
https://{{ elasticsearch_ca }}:9200/_security/role/logstash_writer
245246
delegate_to: "{{ elasticsearch_ca }}"
247+
changed_when: false
246248
run_once: true
247249
when:
248250
- logstash_writer_role_present.rc > 0 or logstash_reset_writer_role | bool
@@ -271,6 +273,7 @@
271273
-u elastic:{{ elastic_password_logstash.stdout }}
272274
https://{{ elasticsearch_ca }}:9200/_xpack/security/user/{{ logstash_user }}
273275
delegate_to: "{{ elasticsearch_ca }}"
276+
changed_when: false
274277
run_once: true
275278
when:
276279
- logstash_writer_user_present.rc > 0
@@ -284,6 +287,7 @@
284287
https://{{ elasticsearch_ca }}:9200/_security/user/{{ logstash_user }}
285288
delegate_to: "{{ elasticsearch_ca }}"
286289
run_once: true
290+
changed_when: false
287291
when:
288292
- logstash_writer_user_present.rc > 0
289293
- elastic_release | int > 7

0 commit comments

Comments
 (0)