--- - name: Install vlan support apt: update_cache: true name: vlan state: present register: apt_result retries: 3 until: apt_result is succeeded - name: Deploy default interfaces config template: src: network/interfaces.j2 dest: /etc/network/interfaces mode: 0644 - name: Remove cloud-init interface configuration file: path: /etc/network/interfaces.d/50-cloud-init state: absent - name: Deploy interfaces config template: src: "network/interfaces.d/ifalias.j2" dest: "/etc/network/interfaces.d/{{ '%02d' | format(item.id) }}-{{ item.name | replace('_', '-') }}" mode: 0644 when: item.name in interfaces loop: "{{ network_interfaces.vlan }}"