|
1 | 1 | --- |
| 2 | +- name: Include elasticstack role |
| 3 | + when: not hostvars[inventory_hostname]._elasticstack_role_imported | default(false) # Ensure the global meta role is only called once for each host |
| 4 | + block: |
| 5 | + - name: Include OS specific vars |
| 6 | + ansible.builtin.include_vars: '{{ item }}' |
| 7 | + with_first_found: |
| 8 | + - '{{ ansible_os_family }}_{{ ansible_distribution_major_version }}.yml' |
| 9 | + - '{{ ansible_os_family }}.yml' |
2 | 10 |
|
3 | | -- name: Include OS specific vars |
4 | | - ansible.builtin.include_vars: '{{ item }}' |
5 | | - with_first_found: |
6 | | - - '{{ ansible_os_family }}_{{ ansible_distribution_major_version }}.yml' |
7 | | - - '{{ ansible_os_family }}.yml' |
| 11 | + - name: Set elasticstack_ca_host variable if not already done by user |
| 12 | + ansible.builtin.set_fact: |
| 13 | + elasticstack_ca: "{{ groups[elasticstack_elasticsearch_group_name][0] }}" |
| 14 | + when: |
| 15 | + - elasticstack_ca_host is undefined |
| 16 | + - groups[elasticstack_elasticsearch_group_name][0] is defined |
8 | 17 |
|
9 | | -- name: Set elasticstack_ca_host variable if not already done by user |
10 | | - ansible.builtin.set_fact: |
11 | | - elasticstack_ca: "{{ groups[elasticstack_elasticsearch_group_name][0] }}" |
12 | | - when: |
13 | | - - elasticstack_ca_host is undefined |
14 | | - - groups[elasticstack_elasticsearch_group_name][0] is defined |
| 18 | + - name: Set elasticstack_ca_host variable if not already set to Elasticsearch server |
| 19 | + ansible.builtin.set_fact: |
| 20 | + elasticstack_ca_host: "{{ groups[elasticstack_logstash_group_name][0] }}" |
| 21 | + when: |
| 22 | + - elasticstack_ca_host is undefined |
| 23 | + - groups[elasticstack_logstash_group_name][0] is defined |
15 | 24 |
|
16 | | -- name: Set elasticstack_ca_host variable if not already set to Elasticsearch server |
17 | | - ansible.builtin.set_fact: |
18 | | - elasticstack_ca_host: "{{ groups[elasticstack_logstash_group_name][0] }}" |
19 | | - when: |
20 | | - - elasticstack_ca_host is undefined |
21 | | - - groups[elasticstack_logstash_group_name][0] is defined |
| 25 | + - name: Set versions for components |
| 26 | + ansible.builtin.import_tasks: elasticstack-versions.yml |
22 | 27 |
|
23 | | -- name: Set versions for components |
24 | | - ansible.builtin.import_tasks: elasticstack-versions.yml |
| 28 | + - name: Fetch passwords if passwords are initialized |
| 29 | + ansible.builtin.import_tasks: elasticstack-passwords.yml |
25 | 30 |
|
26 | | -- name: Fetch passwords if passwords are initialized |
27 | | - ansible.builtin.import_tasks: elasticstack-passwords.yml |
| 31 | + - name: Set elasticstack_globals_set for other roles to skip this role |
| 32 | + ansible.builtin.set_fact: |
| 33 | + elasticstack_globals_set: true |
28 | 34 |
|
29 | | -- name: Set elasticstack_globals_set for other roles to skip this role |
30 | | - ansible.builtin.set_fact: |
31 | | - elasticstack_globals_set: true |
| 35 | + - name: Install common packages and dependencies |
| 36 | + ansible.builtin.import_tasks: packages.yml |
32 | 37 |
|
33 | | -- name: Install common packages and dependencies |
34 | | - ansible.builtin.import_tasks: packages.yml |
| 38 | + - name: Register elasticstack role has run for that host |
| 39 | + ansible.builtin.set_fact: |
| 40 | + _elasticstack_role_imported: true |
0 commit comments