
Lineinfile be damned - oaf357
https://chrisshort.net/lineinfile-be-damned/
======
pferde
It seems to me that the regular expressions used in the module's "regexp" and
"insertafter"/"insertbefore" parameters could mess it all up in case the
config files contain comments with the used strings, e.g. "# Following won't
work without SSLEngine enabled".

Perhaps use the beginning-of-line anchor, e.g. "^[ \t]SSLEngine on[ \t]".

The trailing whitespace can be problematic as well - what if I have a line "
SSLEngine on", that is, no whitespace after "on" ?

~~~
oaf357
This is a valid concern. Thanks for pointing it out. I will update the
article.

~~~
pferde
Glad to have helped. I find that whenever you do something non-trivial with
regular expressions, it is a good idea to have someone else look at it, as no
two minds work alike, and they can see what you don't.

I see you only updated the regex in one of the playbook tasks in your article.
The issue I pointed out apply to all of the tasks, however, and also for
"regexp", as well as "insertafter/before" parameters.

