2020-09-19 21:39:57 +02:00
|
|
|
---
|
|
|
|
- name: Install logstash
|
|
|
|
become: yes
|
|
|
|
apt:
|
|
|
|
name: logstash
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Create Grok patterns directory
|
|
|
|
become: yes
|
|
|
|
file:
|
|
|
|
path: /etc/logstash/patterns
|
|
|
|
state: directory
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rwx,g=rx,o=rx
|
|
|
|
|
|
|
|
- name: Deploy Grok patterns
|
|
|
|
become: yes
|
|
|
|
copy:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: /etc/logstash/patterns/
|
|
|
|
owner: logstash
|
|
|
|
group: logstash
|
|
|
|
mode: u=r,g=,o=
|
|
|
|
with_fileglob:
|
|
|
|
- patterns/*
|
|
|
|
|
|
|
|
- name: Deploy logstash configuration
|
|
|
|
become: yes
|
|
|
|
template:
|
|
|
|
src: "{{ item }}.j2"
|
|
|
|
dest: "/etc/logstash/conf.d/{{ item }}"
|
|
|
|
owner: logstash
|
|
|
|
group: logstash
|
|
|
|
mode: u=r,g=,o=
|
2020-09-19 22:08:34 +02:00
|
|
|
loop:
|
2020-09-19 21:39:57 +02:00
|
|
|
- main.conf
|
|
|
|
- sshd.conf
|
|
|
|
- pam_unix.conf
|
|
|
|
notify: Restart logstash
|
|
|
|
|
|
|
|
- name: Enable logstash service
|
|
|
|
become: yes
|
|
|
|
systemd:
|
|
|
|
name: logstash.service
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
...
|