[colug-432] Automatically Edit Configuration File: Ansible Replace Module Using Its Multiline Ability: Bad Regex

jep200404 at columbus.rr.com jep200404 at columbus.rr.com
Thu Nov 19 11:20:10 EST 2015


On Thu, 19 Nov 2015 11:03:45 -0500, jep200404 at columbus.rr.com wrote:

>       replace: dest=/etc/httpd/conf/httpd.conf regexp='(\n<Directory />.*\n(.*\n)*? *Require *all *)denied(\W(.*\n)*?</Directory>)' replace='\1granted\3' backup=yes
> 
> It is a gnarly regex, but it works. 

The first time I run the Ansible playbook, it works as desired
The next time I run the Ansible playbook, it changes something it should not.
Those multiline regexes are hard,
so on to trying Jim Wildman's suggestion on the Centos 7 vm.


More information about the colug-432 mailing list