--- # Tasks for network interfaces # adding ffrl natv4 address to loopback adapter - name: Create interfaces - add ffrl to loopback lineinfile: dest='/etc/network/interfaces' regexp='^[ \t]+up ip address add.*$' insertafter='^iface lo inet loopback.*$' line=' up ip address add {{ffrl_nat_ip}} dev lo' when: ffrl_tun is defined - name: Create interfaces - add ffrl-rule to loopback lineinfile: dest='/etc/network/interfaces' regexp='^[ \t]+up ip rule add from.*$' insertafter='^[ \t]+up ip address add.*$' line=' up ip rule add from {{ffrl_nat_ip}} table ffnet' when: ffrl_tun is defined - name: Create interfaces - add suppress_prefixlength-rule lineinfile: dest='/etc/network/interfaces' insertafter='^[ \t]+up ip rule add from.*$' line=' up ip rule add iif lo table ffnet suppress_prefixlength 0' when: ffrl_tun is defined - name: Create interfaces - add v6 suppress_prefixlength-rule lineinfile: dest='/etc/network/interfaces' insertafter='^[ \t]+up ip rule add iif lo table ffnet suppress_prefixlength 0.*$' line=' up ip -6 rule add iif lo table ffnet suppress_prefixlength 0' when: ffrl_tun is defined # creating gretap tunnels to ffrl - name: Create interfaces - gretap to ffrl template: src="gre_ffrl.j2" dest="/etc/network/interfaces.d/40_gre_ffrl.cfg" notify: - restart networking when: ffrl_tun is defined #append line in interfaces file for reading additional config files - name: let read interfaces from interfaces lineinfile: dest="/etc/network/interfaces" line="source /etc/network/interfaces.d/*" notify: - restart networking when: ffrl_tun is defined