2021-03-01 01:27:56 +01:00
|
|
|
---
|
|
|
|
- name: Install rsyslog-relp if needed
|
|
|
|
become: true
|
|
|
|
apt:
|
|
|
|
name: rsyslog-relp
|
|
|
|
state: latest
|
|
|
|
when: "rsyslog_inputs | selectattr('proto', 'eq', 'relp') | list"
|
|
|
|
|
|
|
|
- name: Ensure log storage directory exists
|
|
|
|
become: true
|
|
|
|
file:
|
|
|
|
path: "{{ rsyslog_collector_base_dir }}"
|
|
|
|
state: directory
|
2021-03-01 02:26:22 +01:00
|
|
|
owner: root
|
|
|
|
group: adm
|
|
|
|
mode: u=rwx,g=rwx,o=
|
2021-03-01 01:27:56 +01:00
|
|
|
|
|
|
|
- name: Deploy rsyslog input configuration file
|
|
|
|
become: true
|
|
|
|
template:
|
2021-03-01 02:11:29 +01:00
|
|
|
src: 20-collector.conf.j2
|
|
|
|
dest: /etc/rsyslog.d/20-collector.conf
|
2021-03-01 01:27:56 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
notify: Restart rsyslog
|
2021-03-01 03:58:58 +01:00
|
|
|
|
|
|
|
- name: Install rotate script
|
|
|
|
become: true
|
|
|
|
copy:
|
|
|
|
src: rotate
|
|
|
|
dest: "{{ rsyslog_collector_rotate_path }}"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rwx,g=rx,o=
|
|
|
|
|
|
|
|
- name: Install timer and service for rotate script
|
|
|
|
become: true
|
|
|
|
template:
|
|
|
|
src: "{{ item }}.j2"
|
|
|
|
dest: "/etc/systemd/system/{{ item }}"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=r,o=
|
|
|
|
loop:
|
|
|
|
- rotate-remote-logs.timer
|
|
|
|
- rotate-remote-logs.service
|
|
|
|
notify:
|
|
|
|
- Run systemd daemon-reload
|
|
|
|
|
|
|
|
- name: Enable timer for log rotation
|
|
|
|
become: true
|
|
|
|
systemd:
|
|
|
|
name: rotate-remote-logs.timer
|
|
|
|
enabled: true
|
|
|
|
state: started
|
2021-03-01 01:27:56 +01:00
|
|
|
...
|