2021-03-01 01:27:30 +01:00
|
|
|
---
|
|
|
|
- name: Install rsyslog
|
|
|
|
become: true
|
|
|
|
apt:
|
|
|
|
name: rsyslog
|
|
|
|
state: latest
|
|
|
|
|
|
|
|
- name: Install rsyslog modules if needed
|
|
|
|
become: true
|
|
|
|
apt:
|
|
|
|
name: "{{ item.pkg }}"
|
|
|
|
state: latest
|
|
|
|
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
|
|
|
|
become: true
|
|
|
|
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
|
|
|
|
become: true
|
|
|
|
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
|
|
|
|
become: true
|
|
|
|
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
|
|
|
|
|
|
|
|
- name: Enable rsyslog service
|
|
|
|
become: true
|
|
|
|
systemd:
|
|
|
|
name: rsyslog.service
|
|
|
|
state: started
|
|
|
|
enabled: true
|
|
|
|
...
|