2021-03-01 01:27:30 +01:00
|
|
|
---
|
|
|
|
- name: Install rsyslog
|
|
|
|
apt:
|
|
|
|
name: rsyslog
|
2021-03-13 05:05:30 +01:00
|
|
|
state: present
|
2021-03-01 01:27:30 +01:00
|
|
|
|
|
|
|
- name: Install rsyslog modules if needed
|
|
|
|
apt:
|
|
|
|
name: "{{ item.pkg }}"
|
2021-03-13 05:05:30 +01:00
|
|
|
state: present
|
2021-03-01 01:27:30 +01:00
|
|
|
when: "rsyslog_outputs | selectattr('proto', 'eq', item.proto) | list"
|
|
|
|
loop:
|
|
|
|
- proto: relp
|
|
|
|
pkg: rsyslog-relp
|
|
|
|
- proto: redis
|
|
|
|
pkg: rsyslog-hiredis
|
|
|
|
|
|
|
|
- name: Deploy main rsyslog configuration
|
|
|
|
template:
|
|
|
|
src: "{{ item.src }}"
|
|
|
|
dest: "{{ item.dest }}"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
loop:
|
|
|
|
- src: rsyslog.conf.j2
|
|
|
|
dest: /etc/rsyslog.conf
|
2021-03-01 02:11:29 +01:00
|
|
|
- src: 10-common.conf.j2
|
|
|
|
dest: /etc/rsyslog.d/10-common.conf
|
2021-03-01 01:27:30 +01:00
|
|
|
notify: Restart rsyslog
|
|
|
|
|
|
|
|
- name: Create journald.conf.d directory
|
|
|
|
file:
|
|
|
|
path: /etc/systemd/journald.conf.d
|
|
|
|
state: directory
|
2021-03-01 02:26:22 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rwx,g=rx,o=rx
|
2021-03-01 01:27:30 +01:00
|
|
|
|
|
|
|
- name: Deploy journald configuration
|
|
|
|
template:
|
|
|
|
src: forward-syslog.conf.j2
|
|
|
|
dest: /etc/systemd/journald.conf.d/forward-syslog.conf
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
notify: Restart systemd-journald
|
|
|
|
|
2021-03-30 06:01:43 +02:00
|
|
|
- name: Deploy logrotate configuration
|
|
|
|
template:
|
|
|
|
src: logrotate.j2
|
|
|
|
dest: /etc/logrotate.d/rsyslog
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=r,o=r
|
2021-03-30 07:42:46 +02:00
|
|
|
notify: Reload logrotate
|
2021-03-30 06:01:43 +02:00
|
|
|
|
2021-03-01 01:27:30 +01:00
|
|
|
- name: Enable rsyslog service
|
|
|
|
systemd:
|
|
|
|
name: rsyslog.service
|
|
|
|
state: started
|
|
|
|
enabled: true
|
|
|
|
...
|