main.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ---
  2. # Tasks for network interfaces
  3. # adding ffrl natv4 address to loopback adapter
  4. - name: Create interfaces - add ffrl to loopback
  5. lineinfile:
  6. dest='/etc/network/interfaces'
  7. regexp='^[ \t]+up ip address add.*$'
  8. insertafter='^iface lo inet loopback.*$'
  9. line=' up ip address add {{ffrl_nat_ip}} dev lo'
  10. when: ffrl_tun is defined
  11. - name: Create interfaces - add ffrl-rule to loopback
  12. lineinfile:
  13. dest='/etc/network/interfaces'
  14. regexp='^[ \t]+up ip rule add from.*$'
  15. insertafter='^[ \t]+up ip address add.*$'
  16. line=' up ip rule add from {{ffrl_nat_ip}} table ffnet'
  17. when: ffrl_tun is defined
  18. - name: Create interfaces - add suppress_prefixlength-rule
  19. lineinfile:
  20. dest='/etc/network/interfaces'
  21. insertafter='^[ \t]+up ip rule add from.*$'
  22. line=' up ip rule add iif lo table ffnet suppress_prefixlength 0'
  23. when: ffrl_tun is defined
  24. - name: Create interfaces - add v6 suppress_prefixlength-rule
  25. lineinfile:
  26. dest='/etc/network/interfaces'
  27. insertafter='^[ \t]+up ip rule add iif lo table ffnet suppress_prefixlength 0.*$'
  28. line=' up ip -6 rule add iif lo table ffnet suppress_prefixlength 0'
  29. when: ffrl_tun is defined
  30. # creating gretap tunnels to ffrl
  31. - name: Create interfaces - gretap to ffrl
  32. template: src="gre_ffrl.j2" dest="/etc/network/interfaces.d/40_gre_ffrl.cfg"
  33. notify:
  34. - restart networking
  35. when: ffrl_tun is defined
  36. #append line in interfaces file for reading additional config files
  37. - name: let read interfaces from interfaces
  38. lineinfile: dest="/etc/network/interfaces" line="source /etc/network/interfaces.d/*"
  39. notify:
  40. - restart networking
  41. when: ffrl_tun is defined