I wanted to search and replace "GATEWAY=192.168.0.253" in ansible plabook. I've below code but string is not getting replaced. I am not good with Any help will be appreciated to match the string end of the line.
tasks:
- name: "Homenet GateWay Change"
replace:
dest: /opt/ifcfg-br0
regexp: '^(GATEWAY=)\s*$'
replace: 'GATEWAY=192.168.0.1'
backup: yes
when: HOMENET
- name: "Hoemnet DNS Change"
replace:
dest: /opt/ifcfg-br0
regexp: '^(DNS1=)\s*$'
replace: 'DNS1=192.168.0.1'
backup: yes
when: HOMENET
- service: name=network state=restarted
'GATEWAY=[0-9.]+'
regex.