57 lines
1.2 KiB
YAML
57 lines
1.2 KiB
YAML
---
|
|
- 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
|
|
- src: 99-common.conf.j2
|
|
dest: /etc/rsyslog.d/99-common.conf
|
|
notify: Restart rsyslog
|
|
|
|
- name: Create journald.conf.d directory
|
|
become: true
|
|
file:
|
|
path: /etc/systemd/journald.conf.d
|
|
state: directory
|
|
|
|
- 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
|
|
...
|