2016-11-17 16:46:38 +01:00
|
|
|
---
|
2023-03-19 11:44:53 +01:00
|
|
|
- name: APT sources
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.import_tasks: apt_sources.yml
|
2023-03-19 11:44:53 +01:00
|
|
|
args:
|
|
|
|
apply:
|
|
|
|
tags:
|
|
|
|
- logstash
|
|
|
|
- packages
|
2022-12-02 15:17:42 +01:00
|
|
|
|
2016-11-17 16:46:38 +01:00
|
|
|
- name: Logstash is installed
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.apt:
|
2016-11-17 16:46:38 +01:00
|
|
|
name: logstash
|
2017-01-12 17:37:48 +01:00
|
|
|
state: present
|
2016-11-17 16:46:38 +01:00
|
|
|
tags:
|
2021-05-06 10:42:12 +02:00
|
|
|
- logstash
|
2016-11-17 16:46:38 +01:00
|
|
|
- packages
|
|
|
|
|
|
|
|
- name: Logstash service is enabled
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.systemd:
|
2016-11-17 16:46:38 +01:00
|
|
|
name: logstash
|
|
|
|
enabled: yes
|
2021-05-06 10:42:12 +02:00
|
|
|
tags:
|
|
|
|
- logstash
|
2016-11-18 12:02:55 +01:00
|
|
|
|
|
|
|
- name: JVM Heap size (min) is set
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2016-11-18 12:02:55 +01:00
|
|
|
dest: /etc/logstash/jvm.options
|
|
|
|
regexp: "^-Xms"
|
|
|
|
line: "-Xms{{ logstash_jvm_xms }}"
|
|
|
|
tags:
|
2021-05-06 10:42:12 +02:00
|
|
|
- logstash
|
2016-11-18 12:02:55 +01:00
|
|
|
- config
|
|
|
|
|
|
|
|
- name: JVM Heap size (max) is set
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2016-11-18 12:02:55 +01:00
|
|
|
dest: /etc/logstash/jvm.options
|
|
|
|
regexp: "^-Xmx"
|
|
|
|
line: "-Xmx{{ logstash_jvm_xmx }}"
|
|
|
|
tags:
|
2021-05-06 10:42:12 +02:00
|
|
|
- logstash
|
2016-11-18 12:02:55 +01:00
|
|
|
- config
|
2017-05-24 16:09:12 +02:00
|
|
|
|
|
|
|
- name: Add a configuration
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.template:
|
2017-05-24 16:09:12 +02:00
|
|
|
src: "{{ item }}"
|
|
|
|
dest: /etc/logstash/conf.d/logstash.conf
|
2017-12-04 16:01:33 +01:00
|
|
|
owner: logstash
|
|
|
|
group: logstash
|
|
|
|
mode: "0640"
|
2021-09-21 14:41:07 +02:00
|
|
|
force: "{{ logstash_config_force | bool }}"
|
2021-05-04 13:39:47 +02:00
|
|
|
loop: "{{ query('first_found', templates) }}"
|
|
|
|
vars:
|
|
|
|
templates:
|
|
|
|
- "templates/logstash/logstash.{{ inventory_hostname }}.conf.j2"
|
2021-05-19 14:35:08 +02:00
|
|
|
- "templates/logstash/logstash.{{ host_group | default('all') }}.conf.j2"
|
2021-05-04 13:39:47 +02:00
|
|
|
- "templates/logstash/logstash.default.conf.j2"
|
|
|
|
- "templates/logstash.default.conf.j2"
|
2017-05-24 16:09:12 +02:00
|
|
|
register: logstash_template
|
2021-05-06 10:42:12 +02:00
|
|
|
tags:
|
|
|
|
- logstash
|
|
|
|
- config
|
2017-05-24 16:09:12 +02:00
|
|
|
|
2023-03-20 23:33:19 +01:00
|
|
|
- ansible.builtin.debug:
|
2017-05-24 16:09:12 +02:00
|
|
|
var: logstash_template
|
|
|
|
verbosity: 1
|
2017-11-14 11:07:13 +01:00
|
|
|
|
2023-03-20 23:33:19 +01:00
|
|
|
- ansible.builtin.include: logs.yml
|
2018-09-20 12:11:04 +02:00
|
|
|
|
2023-03-20 23:33:19 +01:00
|
|
|
- ansible.builtin.include: tmpdir.yml
|