---

- name: Check if NetworkManager package is installed
  command: dpkg -s network-manager
  register: nm_installed_check
  failed_when: nm_installed_check.rc > 1

- name: Stop NetworkManager
  service:
    name: network-manager
    state: stopped
    enabled: no
  when: nm_installed_check.rc == 0

- name: Remove NetworkManager
  apt:
    pkg: network-manager
    state: absent

- name: Configure network interfaces
  template:
    src: etc_network_interfaces.j2
    dest: /etc/network/interfaces
    owner: root
    group: root
    mode: 0644
  register: etc_network_interfaces

# Note: this is not a handler because we need the network configuration in
# effect before proceeding with the wifi-ap and firewall roles, which will
# otherwise fail if not.
- name: Restart network
  service:
    name: systemd-networkd.service
    state: restarted
  when: etc_network_interfaces.changed
  tags:
    # This task on change is intentionally not a handler; don't trigger ANSIBLE0016
    - skip_ansible_lint



---

- name: Check if NetworkManager package is installed
  command: dpkg -s network-manager
  register: nm_installed_check
  failed_when: nm_installed_check.rc > 1

- name: Stop NetworkManager
  service:
    name: network-manager
    state: stopped
    enabled: no
  when: nm_installed_check.rc == 0

- name: Remove NetworkManager
  apt:
    pkg: network-manager
    state: absent

- name: Configure network interfaces NEO
  template:
    src: etc_network_interfaces.j2
    dest: /etc/network/interfaces
    owner: root
    group: root
    mode: 0644
  when: connectbox_os != "raspbian"
  register: etc_network_interfaces

- name: Configure network interfaces RPi
  template:
    src: etc_network_interfaces-RPi.j2
    dest: /etc/network/interfaces
    owner: root
    group: root
    mode: 0644
  when: connectbox_os == "raspbian"
  register: etc_network_interfaces

# Note: this is not a handler because we need the network configuration in
# effect before proceeding with the wifi-ap and firewall roles, which will
# otherwise fail if not.
- name: Restart network
  service:
    name: systemd-networkd.service
    state: restarted
  when: etc_network_interfaces.changed
  tags:
    # This task on change is intentionally not a handler; don't trigger ANSIBLE0016
    - skip_ansible_lint



Create separate NEO/RPi network configurations
Create separate NEO/RPi network configurations