Re: [ansible-project] using regex in replace module

2018-12-14 Thread danish09
brilliant. thank you very much. finally seem to be making sense of regular expressions some what but still have a long way to go Thanks again. On Thursday, 13 December 2018 17:24:29 UTC, Dick Visser wrote: > > On Thu, 13 Dec 2018 at 17:42, danish09 > wrote: > > > > amazing. thanks a lot. tri

Re: [ansible-project] using regex in replace module

2018-12-13 Thread Dick Visser
On Thu, 13 Dec 2018 at 17:42, danish09 wrote: > > amazing. thanks a lot. tried it just now and it did the magic. However, tried > to give it a little thought. I am assuming 1 is for the expression with in > the first bracket (). But since it is an OR '|', how does it know which word > needs to

Re: [ansible-project] using regex in replace module

2018-12-13 Thread danish09
amazing. thanks a lot. tried it just now and it did the magic. However, tried to give it a little thought. I am assuming 1 is for the expression with in the first bracket (). But since it is an OR '|', how does it know which word needs to be replaced with what and in which line. I mean could it

Re: [ansible-project] using regex in replace module

2018-12-13 Thread Dick Visser
This should do it: - name: backup conf file and search and replace regex replace: path: /etc/nginx/sites-available/cruk-eb regexp: '(privkey|cert)\.cruk\.org\.(key\.pem|crt)' replace: '\g<1>3.pem' backup: yes Dick On Thu, 13 Dec 2018 at 11:23, danish09

[ansible-project] using regex in replace module

2018-12-13 Thread danish09
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 re