I'm trying to replicate the following sed snippet in ansible's lineinfile module.
sed -i '/# The named pipe \/dev\/xconsole/,$d' /etc/rsyslog.conf
I know that I can template the file or brute force match the lines but I'd like to learn how to do the sed trick of matching to end of file with ansible. I am also aware the matching blindly to the end of the file isn't great practice either.
This was lifted from this blog post: https://blog.dantup.com/2016/04/removing-rsyslog-spam-on-raspberry-pi-raspbian-jessie/
The aim is to fix this error in rsyslog:
raspberrypi rsyslogd-2007: action 'action 17' suspended, next retry is Sat Apr 2 01:24:21 2016 [try http://www.rsyslog.com/e/2007 ]
This error is caused by section at the end the config file /etc/rsyslog.conf
# The named pipe /dev/xconsole is for the `xconsole' utility. To use it,
# you must invoke `xconsole' with the `-file' option:
#
# $ xconsole -file /dev/xconsole [...]
#
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably
# busy site..
#
daemon.*;mail.*;\
news.err;\
*.=debug;*.=info;\
*.=notice;*.=warn |/dev/xconsole