---
- name: Reconfigure 'networking' service
  when: dhcp_client in ['udhcpc', 'dhcpcd', 'dhclient']
  block:
    - name: networking | Configure /etc/network/interfaces
      template:
        src: networking/interfaces.j2
        dest: /etc/network/interfaces
        owner: root
        group: root
        mode: '644'

    - name: networking | Restart 'networking' service
      service:
        name: networking
        state: restarted
        enabled: true
        runlevel: boot

- name: networking | Stop 'networking' service on boot in favor of {{ dhcp_client }}
  service:
    name: networking
    enabled: false
    runlevel: boot
  when: not dhcp_client in ['udhcpc', 'dhcpcd', 'dhclient']
