--- - name: Install bridge-utils apt: name: bridge-utils state: present when: network_br - lineinfile: path: /etc/sysctl.conf regexp: ^#?net.ipv4.ip_forward line: "net.ipv4.ip_forward=1 # Managed by Ansible" notify: reboot when: network_br - lineinfile: path: /etc/sysctl.conf regexp: ^#?net.ipv6.conf.all.forwarding line: "net.ipv6.conf.all.forwarding=1 # Managed by Ansible" notify: reboot when: network_br - name: Make network interfaces really predictable lineinfile: path: /etc/default/grub regexp: ^GRUB_CMDLINE_LINUX line: 'GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0" # Managed by Ansible' notify: - update grub - reboot when: network_br or network_dhcp or network_static - name: Configure network interfaces template: src: network-interfaces dest: /etc/network/interfaces owner: root group: root mode: 0644 notify: reboot when: network_br or network_dhcp or network_static - meta: flush_handlers