[lopsa-tech] ansible regex help

2015-11-06 Thread Edward Ned Harvey (lopser)
I want ansible to comment-out all lines in a file, if they aren't already commented out. Here's what I have: replace: dest=/etc/httpd/conf.d/welcome.conf regexp='(^[^#].*)' replace='# \1' The problem is, the file has some blank lines. When ansible encounters a blank line, it comments it out, an

Re: [lopsa-tech] ansible regex help

2015-11-06 Thread Brandon Allbery
I'm thinking the problem is that it is allowing any character to match [^#] --- including newline, which you likely do not expect. Try [^#\n] instead. On Fri, Nov 6, 2015 at 5:45 PM, Edward Ned Harvey (lopser) < lop...@nedharvey.com> wrote: > I want ansible to comment-out all lines in a file, if

Re: [lopsa-tech] ansible regex help

2015-11-06 Thread Edward Ned Harvey (lopser)
> From: Brandon Allbery [mailto:allber...@gmail.com] > > I'm thinking the problem is that it is allowing any character to match [^#] > --- > including newline, which you likely do not expect. Try [^#\n] instead. Thanks, that worked. But I'm still going to have to conclude that it's a bug, becau