Hey there,

I am using ansible 2.6.4. In on the projects I was working on, I had to 
search for 2 different words in the same file and replace them as 
necessary. Used *replace* module 2 times for this. Below is the playbook 
that I have used.

    - name: backup conf file and search and replace regex
      replace:
        path: /etc/nginx/sites-available/cruk-eb
        regexp: 'cert\.cruk\.org\.crt'
        replace: 'cert3.pem'
        backup: yes

    - name: backup conf file and search and replace regex again
      replace:
        path: /etc/nginx/sites-available/cruk-eb
        regexp: 'privkey\.cruk\.org\.key\.pem'
        replace: 'privkey3.pem'
        backup: yes


Is there a way that I can search and replace 2 words in one task/play


Pleas let me know if there is any other information that you need. And 
apologies if I have missed out anything.


Thanks

Danish.



 

-- 
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/157209d1-ad23-4f62-ab98-bf5a373227da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to