Hello Kai,

Great Advise!!!!! Thanks a lot for your help. It worked like a magic... 



On Tuesday, November 27, 2018 at 9:37:03 PM UTC+5:30, Kai Stian Olstad 
wrote:
>
> On Tuesday, 27 November 2018 16:27:02 CET vowner wrote: 
> > -> 
> > #<VirtualHost *:443> 
> >  #SSLEnable 
> >  #Header always set Strict-Transport-Security "max-age=31536000; 
> > includeSubDomains; preload" 
> > #</VirtualHost> 
> > -> 
> > 
> > Expected output 
> > ____________ 
> > 
> > <VirtualHost *:443> 
> >  SSLEnable 
> >  #Header always set Strict-Transport-Security "max-age=31536000; 
> > includeSubDomains; preload" 
> > </VirtualHost> 
> > 
> > -> 
> > 
> > below is my play 
> > 
> > -> 
> > - name: uncomment virtualhost starting line 
> >      replace: 
> >        path: /opt/conf/httpd.conf 
> >        regexp: '^#(.*<VirtualHost *:443>.*)' 
> >        replace: '\1' 
> >  - name: uncomment virtualhost end line 
> >      replace: 
> >        path: /opt/conf/httpd.conf 
> >        regexp: '^#(.*</VirtualHost>.*)' 
> >        replace: '\1' 
> > 
> > 
> > 
> > -> 
> > 
> > Here my virtualhost end line is getting uncommented but the startline is 
> > not.. can you please guide me here..... 
>
> You have a * in you data, * is a regexp special character, when you are 
> using a special character as a literal character you need to escape it. 
> So this should work: 
>   regexp: '^#(.*<VirtualHost \*:443>.*)' 
>
>
> -- 
> Kai Stian Olstad 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a20288bf-2310-42fd-a671-f4f3dea6e858%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to