I am not sure if this is an ansible core bug, or a module bug, or even a python bug, so I’m not sure exactly how to report the bug. But I’m quite certain it’s a bug.
I want to comment out all lines in a file, that aren’t already commented out. So I use this:
replace: dest=/etc/httpd/conf.d/welcome.conf regexp=‘^([^#].*)’ replace=‘# \1’
This works fine for most lines. The .* matches all characters up to, but not including, the newline. The problem is, for blank lines, the .* matches the newline character. So the blank line gets commented out, and all the lines following the blank lines get skipped. The behavior is the same for .* or .?
I’m running ansible 1.9, centos7, and python 2.7.5