Assume that shorewall rules config contain
ACCEPT net:1.234.5.253 all tcp 3306
ACCEPT net:1.234.5.2 all tcp 80
ACCEPT net:1.234.5.2 all tcp 80
ACCEPT net:1.2.3.4,1.234.5.22,1.1.1.1 all tcp 3306
I want replace them with ansible
- name: Replace old ips in /etc/shorewall/rules
replace:
path: /etc/shorewall/rules
regexp: '{{ oldip }}'
replace: '{{ newip }}'
backup: 'yes'
Variables are
vars:
oldip: 1.234.5.2
newip: 100.100.100.100
Im getting output which is correct, but im expecting replace EXACT match of ip not this output
ACCEPT net:100.100.100.10053 all tcp 3306
ACCEPT net:100.100.100.100 all tcp 80
ACCEPT net:100.100.100.100 all tcp 80
ACCEPT net:1.2.3.4,100.100.100.1002,1.1.1.1 all tcp 3306
Is there any way how to solve it ?
Asked by Petr Schönmann
(5 rep)
Jul 15, 2020, 05:09 PM
Last activity: Jul 15, 2020, 06:40 PM
Last activity: Jul 15, 2020, 06:40 PM