rsyslog: use variables for paths

This commit is contained in:
Ryan Cavicchioni 2024-04-14 17:51:22 -05:00
parent 01314cb137
commit 9acc10b73f
3 changed files with 22 additions and 5 deletions

View File

@ -33,3 +33,9 @@ rsyslog_default_rules_state: file
rsyslog_default_rules: []
rsyslog_rules: []
rsyslog_archival_format_enabled: false
rsyslog_etc_path: /etc/rsyslog.d
rsyslog_config_path: /etc/rsyslog.conf
rsyslog_d:
[]

View File

@ -50,7 +50,7 @@
- name: configure archival format
template:
src: archival.conf.j2
dest: /etc/rsyslog.d/10-archival.conf
dest: "{{ rsyslog_etc_path }}/10-archival.conf"
owner: root
group: root
mode: 0644
@ -59,7 +59,7 @@
- name: manage archive rules
file:
path: /etc/rsyslog.d/10-archival.conf
path: "{{ rsyslog_etc_path }}/10-archival.conf"
state: "{{ rsyslog_archival_format_enabled | ternary('file', 'absent') }}"
- name: compress log cron job

View File

@ -14,7 +14,7 @@
- name: configure
template:
src: rsyslog.conf.j2
dest: /etc/rsyslog.conf
dest: "{{ rsyslog_config_path }}"
owner: root
group: root
mode: 0644
@ -26,7 +26,7 @@
- name: configure default rules
template:
src: default.conf.j2
dest: /etc/rsyslog.d/50-default.conf
dest: "{{ rsyslog_etc_path }}/50-default.conf"
owner: root
group: root
mode: 0644
@ -35,8 +35,19 @@
- name: manage default rules
file:
path: /etc/rsyslog.d/50-default.conf
path: "{{ rsyslog_etc_path }}/50-default.conf"
state: "{{ rsyslog_default_rules_state }}"
notify: restart rsyslog
- name: configure rsyslog.d rules
ansible.builtin.copy:
dest: "{{ rsyslog_etc_path }}/{{ item.priority }}-{{ item.name }}.conf"
owner: root
group: root
mode: 0644
content: "{{ item.content }}"
loop: "{{ rsyslog_d | default([]) }}"
notify: restart rsyslog
- name: manage service
service: