2 ms·
Lineinfile be damned
- pferde 10y agoIt 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 10y agoThis is a valid concern. Thanks for pointing it out. I will update the article.
- pferde 10y agoGlad 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.