Check for rsyslog.conf, update to regex

This commit is contained in:
Sven Velt 2024-07-09 21:52:55 +00:00
parent dacda31dd7
commit e15c91e45d

View file

@ -1,9 +1,18 @@
---
- name: Disable kernel logging
lineinfile:
- name: Check if /etc/rsyslogd.conf exists
ansible.builtin.stat:
path: /etc/rsyslog.conf
regexp: '^\s+#?(.*imklog.)$'
register: rsyslogd_conf
- name: Disable kernel logging
ansible.builtin.lineinfile:
path: /etc/rsyslog.conf
regexp: '^[\s#]*(.*imklog.*)$'
line: '#\1'
backrefs: true
backup: yes
when: rsyslogd_conf.stat.exists
notify: Restart Rsyslog