Skip to content

Commit 17d8240

Browse files
committed
renamed var: elasticsearch_group_name -> elasticstack_elasticsearch_group_name
1 parent 5c2ee70 commit 17d8240

File tree

20 files changed

+55
-55
lines changed

20 files changed

+55
-55
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ There are some comments in the Playbook. Either fill them with the correct value
120120
121121
### Inventory
122122
123-
_Note_: The roles rely on hardcoded group names for placing services on hosts. Please make sure you have groups named `elasticsearch` (or define your desired group name using the var `elasticsearch_group_name`), `logstash` and `kibana` in your Ansible inventory. Hosts in these groups will get the respective services. Just restricting your plays to the appropriate hosts will not work because the roles interact with hosts from other groups e.g. for certificate generation.
123+
_Note_: The roles rely on hardcoded group names for placing services on hosts. Please make sure you have groups named `elasticsearch` (or define your desired group name using the var `elasticstack_elasticsearch_group_name`), `logstash` and `kibana` in your Ansible inventory. Hosts in these groups will get the respective services. Just restricting your plays to the appropriate hosts will not work because the roles interact with hosts from other groups e.g. for certificate generation.
124124
125125
The execution order of the roles is important! (see below)
126126

molecule/elasticsearch_no-security/verify.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
hosts: all
66
vars:
77
elasticstack_elasticsearch_http_port: 9200
8-
elasticsearch_group_name: elasticsearch
8+
elasticstack_elasticsearch_group_name: elasticsearch
99
tasks:
1010

1111
# Remember, this is the no-security scenario. So no https
@@ -20,7 +20,7 @@
2020
until: result.json.status == "green"
2121
retries: 6
2222
delay: 10
23-
when: groups[elasticsearch_group_name] | length > 1
23+
when: groups[elasticstack_elasticsearch_group_name] | length > 1
2424

2525
- name: Node check
2626
ansible.builtin.uri:
@@ -30,7 +30,7 @@
3030
status_code: 200
3131
validate_certs: false
3232
register: nodes
33-
when: groups[elasticsearch_group_name] | length > 1
33+
when: groups[elasticstack_elasticsearch_group_name] | length > 1
3434

3535
- name: Check if all Nodes see each other
3636
ansible.builtin.assert:
@@ -39,4 +39,4 @@
3939
fail_msg: "'{{ item }}' was not found in nodes.content"
4040
success_msg: "'{{ item }}' was found in nodes.content"
4141
with_inventory_hostnames: all
42-
when: groups[elasticsearch_group_name] | length > 1
42+
when: groups[elasticstack_elasticsearch_group_name] | length > 1

molecule/elasticstack_default/verify.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
vars:
66
elasticstack_elasticsearch_http_port: 9200
77
elasticstack_initial_passwords: /usr/share/elasticsearch/initial_passwords
8-
elasticsearch_group_name: elasticsearch
8+
elasticstack_elasticsearch_group_name: elasticsearch
99
tasks:
1010

1111
- name: Run Logstash syntax check
@@ -23,7 +23,7 @@
2323

2424
- name: Set elasticsearch_ca variable if not already done by user
2525
ansible.builtin.set_fact:
26-
elasticsearch_ca: "{{ groups[elasticsearch_group_name][0] }}"
26+
elasticsearch_ca: "{{ groups[elasticstack_elasticsearch_group_name][0] }}"
2727
when: elasticsearch_ca is undefined
2828

2929
- name: fetch Elastic password
@@ -43,22 +43,22 @@
4343
sort -n |
4444
tail -1
4545
register: logstash_count
46-
when: "elasticsearch_group_name is defined and elasticsearch_group_name in group_names"
46+
when: "elasticstack_elasticsearch_group_name is defined and elasticstack_elasticsearch_group_name in group_names"
4747

4848
- name: Show full output
4949
ansible.builtin.debug:
5050
var: logstash_count
51-
when: "elasticsearch_group_name is defined and elasticsearch_group_name in group_names"
51+
when: "elasticstack_elasticsearch_group_name is defined and elasticstack_elasticsearch_group_name in group_names"
5252

5353
- name: Fail when logstash index is empty
5454
ansible.builtin.fail:
5555
msg: "Logstash Index is empty"
56-
when: "elasticsearch_group_name is defined and elasticsearch_group_name in group_names and logstash_count.stdout == 0"
56+
when: "elasticstack_elasticsearch_group_name is defined and elasticstack_elasticsearch_group_name in group_names and logstash_count.stdout == 0"
5757

5858
- name: Show number of received events
5959
ansible.builtin.debug:
6060
msg: "Elasticsearch received {{ logstash_count.stdout }} events so far"
61-
when: "elasticsearch_group_name is defined and elasticsearch_group_name in group_names"
61+
when: "elasticstack_elasticsearch_group_name is defined and elasticstack_elasticsearch_group_name in group_names"
6262

6363
- name: Run Kibana checks
6464
when: "'kibana' in group_names"
@@ -113,7 +113,7 @@
113113
until: result.json.status == "green"
114114
retries: 6
115115
delay: 10
116-
when: groups[elasticsearch_group_name] | length > 1
116+
when: groups[elasticstack_elasticsearch_group_name] | length > 1
117117

118118
- name: Elasticsearch Node check
119119
ansible.builtin.uri:
@@ -126,7 +126,7 @@
126126
status_code: 200
127127
validate_certs: false
128128
register: nodes
129-
when: groups[elasticsearch_group_name] | length > 1
129+
when: groups[elasticstack_elasticsearch_group_name] | length > 1
130130

131131
- name: Check if all Nodes see each other
132132
ansible.builtin.assert:
@@ -135,5 +135,5 @@
135135
fail_msg: "'{{ item }}' was not found in nodes.content"
136136
success_msg: "'{{ item }}' was found in nodes.content"
137137
with_inventory_hostnames: all
138-
when: groups[elasticsearch_group_name] | length > 1
138+
when: groups[elasticstack_elasticsearch_group_name] | length > 1
139139

molecule/logstash_full_stack-oss/verify.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@
2525
sort -n |
2626
tail -1
2727
register: logstash_count
28-
when: "elasticsearch_group_name is defined and elasticsearch_group_name in group_names"
28+
when: "elasticstack_elasticsearch_group_name is defined and elasticstack_elasticsearch_group_name in group_names"
2929
- name: Show full output
3030
ansible.builtin.debug:
3131
var: logstash_count
32-
when: "elasticsearch_group_name is defined and elasticsearch_group_name in group_names"
32+
when: "elasticstack_elasticsearch_group_name is defined and elasticstack_elasticsearch_group_name in group_names"
3333
- name: Fail when logstash is empty
3434
ansible.builtin.fail:
3535
msg: "Logstash Index is empty"
36-
when: "elasticsearch_group_name is defined and elasticsearch_group_name in group_names and logstash_count.stdout == 0"
36+
when: "elasticstack_elasticsearch_group_name is defined and elasticstack_elasticsearch_group_name in group_names and logstash_count.stdout == 0"
3737
- name: Show number of received events
3838
ansible.builtin.debug:
3939
msg: "Elasticsearch received {{ logstash_count.stdout }} events so far"
40-
when: "elasticsearch_group_name is defined and elasticsearch_group_name in group_names"
40+
when: "elasticstack_elasticsearch_group_name is defined and elasticstack_elasticsearch_group_name in group_names"

roles/beats/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ elasticstack_full_stack: true
6363
elasticstack_variant: elastic
6464
elasticstack_security: true
6565

66-
elasticsearch_group_name: elasticsearch
66+
elasticstack_elasticsearch_group_name: elasticsearch
6767

6868
elasticstack_ca_dir: /opt/es-ca
6969
elasticstack_ca_pass: PleaseChangeMe

roles/beats/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727

2828
- name: Set elasticstack_ca variable if not already done by user
2929
ansible.builtin.set_fact:
30-
elasticstack_ca: "{{ groups[elasticsearch_group_name][0] }}"
30+
elasticstack_ca: "{{ groups[elasticstack_elasticsearch_group_name][0] }}"
3131
when:
3232
- beats_security | bool
3333
- elasticstack_ca is undefined
34-
- groups[elasticsearch_group_name] is defined
34+
- groups[elasticstack_elasticsearch_group_name] is defined
3535
tags:
3636
- certificates
3737
- renew_ca

roles/beats/templates/auditbeat.yml.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ setup.kibana:
3333
output.elasticsearch:
3434
{% if elasticsearch_http_security | bool %}
3535
{% if elasticstack_full_stack | bool %}
36-
hosts: [ {% for host in groups[elasticsearch_group_name] %}"https://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
36+
hosts: [ {% for host in groups[elasticstack_elasticsearch_group_name] %}"https://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
3737
{% else %}
3838
hosts: [ {% for host in beats_target_hosts %}"https://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
3939
{% endif %}
@@ -44,7 +44,7 @@ output.elasticsearch:
4444
ssl.certificate_authorities: ["/etc/beats/certs/ca.crt"]
4545
{% else %}
4646
{% if elasticstack_full_stack | bool %}
47-
hosts: [ {% for host in groups[elasticsearch_group_name] %}"http://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
47+
hosts: [ {% for host in groups[elasticstack_elasticsearch_group_name] %}"http://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
4848
{% else %}
4949
hosts: [ {% for host in beats_target_hosts %}"http://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
5050
{% endif %}

roles/beats/templates/filebeat.yml.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ setup.kibana:
108108
output.elasticsearch:
109109
{% if beats_security | bool %}
110110
{% if elasticstack_full_stack | bool %}
111-
hosts: [ {% for host in groups[elasticsearch_group_name] %}"https://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
111+
hosts: [ {% for host in groups[elasticstack_elasticsearch_group_name] %}"https://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
112112
{% else %}
113113
hosts: [ {% for host in beats_target_hosts %}"https://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
114114
{% endif %}
@@ -119,7 +119,7 @@ output.elasticsearch:
119119
ssl.certificate_authorities: ["/etc/beats/certs/ca.crt"]
120120
{% else %}
121121
{% if elasticstack_full_stack | bool %}
122-
hosts: [ {% for host in groups[elasticsearch_group_name] %}"http://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
122+
hosts: [ {% for host in groups[elasticstack_elasticsearch_group_name] %}"http://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
123123
{% else %}
124124
hosts: [ {% for host in beats_target_hosts %}"http://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
125125
{% endif %}

roles/beats/templates/metricbeat.yml.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ setup.kibana:
1010
output.elasticsearch:
1111
{% if elasticsearch_http_security | bool %}
1212
{% if elasticstack_full_stack | bool %}
13-
hosts: [ {% for host in groups[elasticsearch_group_name] %}"https://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
13+
hosts: [ {% for host in groups[elasticstack_elasticsearch_group_name] %}"https://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
1414
{% else %}
1515
hosts: [ {% for host in beats_target_hosts %}"https://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
1616
{% endif %}
@@ -21,7 +21,7 @@ output.elasticsearch:
2121
ssl.certificate_authorities: ["/etc/beats/certs/ca.crt"]
2222
{% else %}
2323
{% if elasticstack_full_stack | bool %}
24-
hosts: [ {% for host in groups[elasticsearch_group_name] %}"http://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
24+
hosts: [ {% for host in groups[elasticstack_elasticsearch_group_name] %}"http://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
2525
{% else %}
2626
hosts: [ {% for host in beats_target_hosts %}"http://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
2727
{% endif %}

roles/elasticsearch/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ elasticstack_variant: elastic
6262
elasticstack_elasticsearch_http_port: 9200
6363
elasticstack_no_log: true
6464

65-
elasticsearch_group_name: elasticsearch
65+
elasticstack_elasticsearch_group_name: elasticsearch

0 commit comments

Comments
 (0)