--- - name: Fix rsyslog behaviour on some ubuntu machines disabling the kernel logger lineinfile: dest=/etc/rsyslog.conf regexp="\\$ModLoad\ imklog" line="#$ModLoad imklog" backup=yes when: - is_precise and ansible_kernel != "3.2.0-4-amd64" - is_not_trusty notify: Restart rsyslog tags: - rsyslog - name: Enable the kernel logger on ubuntu 12.04 and kernel major version >= 3 lineinfile: dest=/etc/rsyslog.conf line="$ModLoad imklog" insertafter="^#$ModLoad imklog" backup=yes when: - is_precise and ansible_kernel == "3.2.0-4-amd64" - is_trusty notify: Restart rsyslog tags: - rsyslog