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 - name: Check if /etc/rsyslogd.conf exists
lineinfile: ansible.builtin.stat:
path: /etc/rsyslog.conf 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' line: '#\1'
backrefs: true
backup: yes backup: yes
when: rsyslogd_conf.stat.exists
notify: Restart Rsyslog notify: Restart Rsyslog