--- # Since students are disabling deliberately the network interface from # NetworkManager, we insert the default interface in /etc/network/interfaces # so they are not available to NM - name: Ensuring first NIC will never be disabled again lineinfile: line: "{{ item }}" state: present dest: /etc/network/interfaces insertafter: EOF with_items: - " " - "auto {{ ansible_default_ipv4.interface }}" - "iface {{ ansible_default_ipv4.interface }} inet dhcp" # Hiding NetworkManager icon from any sessions - name: Disabling NetworkManager from popping up in sessions shell: mv /etc/xdg/autostart/nm-applet.desktop /etc/xdg/autostart/nm-applet.desktop.disabled ignore_errors: yes