-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmain.yml
84 lines (72 loc) · 2.22 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
- name: Include global role
ansible.builtin.import_role:
name: netways.elasticstack.elasticstack
- name: Update apt cache.
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 600
changed_when: false
when: ansible_os_family == 'Debian'
- name: Prepare for whole stack roles if used
when:
- elasticstack_full_stack | bool
block:
- name: Enable security if enabled for whole stack
ansible.builtin.set_fact:
beats_security: true
when:
- elasticstack_security | bool
- elasticstack_variant != "oss"
- not elasticstack_override_beats_tls | bool
- name: Set beats_ca_dir if whole stack is used
ansible.builtin.set_fact:
beats_ca_dir: "/etc/beats/certs"
when:
- elasticstack_security | bool
- beats_ca_dir is undefined
# We need it for templating even when security is disabled
# This default corresponds with the default in Elastic-
# independent "CA" Role
- name: Set beats_ca_dir if whole stack is not used
ansible.builtin.set_fact:
beats_ca_dir: "/opt/ca"
when:
- beats_ca_dir is undefined
tags:
- certificates
- renew_ca
- renew_beats_cert
- name: Create directory for logging if file logging is activated
ansible.builtin.file:
path: "{{ beats_logpath }}"
state: directory
owner: root
group: root
mode: 0750
when: beats_logging == "file"
- name: Import security tasks
ansible.builtin.import_tasks: beats-security.yml
when:
- beats_security | bool
- elasticstack_full_stack | bool
- elasticstack_variant == "elastic"
tags:
- certificates
- renew_ca
- renew_beats_cert
- name: Import Filebeat tasks
ansible.builtin.import_tasks: filebeat.yml
when: beats_filebeat | bool
- name: Import Auditbeat tasks
ansible.builtin.import_tasks: auditbeat.yml
when: beats_auditbeat | bool
- name: Import Metricbeat tasks
ansible.builtin.import_tasks: metricbeat.yml
when: beats_metricbeat | bool
# Free up some space to let elsticsearch allocate replica in GitHub Action
- name: Remove cache
ansible.builtin.command: >
rm -rf /var/cache/*
changed_when: false
when: ansible_virtualization_type == "container" or ansible_virtualization_type == "docker"