- block:

  - name: Remove persistent net rules and generator
    file:
      path: "{{ item }}"
      state: absent
    with_items:
      - /lib/udev/rules.d/75-persistent-net-generator.rules
      - /etc/udev/rules.d/70-persistent-net.rules

  - name: Install udev rules for ethernet
    copy:
      src: "73-zoox-ethernet.rules"
      dest: "/etc/udev/rules.d/73-zoox-ethernet.rules"
      owner: root
      group: root
      mode: '644'

  - name: Install networking packages
    apt:
      name:
        - ifenslave
        - ifplugd
        - vlan
      cache_valid_time: "{{ apt_cache_valid_time }}"
      install_recommends: no

  - name: Uninstall network-manager
    apt:
      name: network-manager
      state: absent
      purge: yes

  - name: Configure network interfaces
    template:
      src: "{{ 'interfaces-3.5.j2' if zoox_compute_version is version('3.5', '=') else 'interfaces-legacy.j2' }}"
      dest: /etc/network/interfaces
      owner: root
      group: root
      mode: '644'

  - name: Install wall ifplugd configuration
    copy:
      src: ifplugd_configuration
      dest: /etc/default/ifplugd
      owner: root
      group: root
      mode: '644'

  - name: Enable services
    service:
      name: "{{ item }}"
      enabled: true
      state: restarted
    with_items:
      - ifplugd

  become: yes
