Hello,
I’m trying to replace an Ip address by anoher in a file but it doesn’t work :
Initial file contains :
My code below doesn’t work (invalid group reference) :
- name : Change IP in file
replace: dest=myfile.xml regexp=‘(.){{master_ip}}(.)’ replace=‘\1{{ansible_default_ipv4.address}}\2’
But If i put 1 space before and after my variable, it works but have useless spaces.
- name : Change IP in file
replace: dest=myfile.xml regexp=‘(.){{master_ip}}(.)’ replace=‘\1 {{ansible_default_ipv4.address}} \2’
Result :
Some has got any clue of the trouble ?
thanks