--- # tasks file for network-manager #- name: "apt install NetworkManager {{ nm_version }} " # when: nm__skip_install is not true # apt: # name: "network-manager{{ nm_version }}" # default_release: "{{ ansible_distribution_release }}-backports" # autoremove: true # update_cache: true - name: Get OS and major version specific for NetworkManager installation ansible.builtin.set_fact: install_nm_tasks: >- {%- if ansible_distribution == "Debian" and ansible_distribution_major_version == "12" -%} install-nm.debian-12.yml {%- elif ansible_distribution == "Debian" and ansible_distribution_major_version in ["10", "11"] -%} install-nm.debian-10.yml {%- elif ansible_distribution == "Ubuntu" -%} install-nm.ubuntu.yml {%- else -%} install-nm.default.yml {%- endif -%} - name: Install NetworkManager for {{ ansible_distribution }} {{ ansible_distribution_major_version }} ansible.builtin.include_tasks: "{{ install_nm_tasks }}" - name: Enable service NetworkManager and ensure it is not masked ansible.builtin.systemd_service: name: NetworkManager enabled: true masked: no - name: Configure globally managed devices to NM ansible.builtin.template: src: "conf.d/10-globally-managed-devices.j2" dest: "{{ globally_managed_devices_path }}" owner: root group: root mode: 0644 when: globally_managed_devices is true notify: Restart NetworkManager - name: Cleanup globally managed devices ansible.builtin.file: path: "{{ globally_managed_devices_path }}" state: absent when: not globally_managed_devices notify: Restart NetworkManager - name: Include tasks for checking and removing udev rules ansible.builtin.include_tasks: check_udev_rules.yml - name: Include tasks for managing connections when: network is defined ansible.builtin.include_tasks: connections.config.yml - name: Notify the reboot handler meta: flush_handlers