xoxys.network/tasks/nm.yml

33 lines
1019 B
YAML

---
- block:
- name: Add NetworkManager configuration
copy:
content: "{{ item.value }}"
dest: "/etc/NetworkManager/conf.d/{{ item.key }}.conf"
owner: root
group: root
mode: 0640
loop: "{{ network_nm_config | dict2items }}"
loop_control:
label: "{{ item.key }}"
notify: __network_host_reboot
- name: Register active NetworkManager configuration
find:
paths: /etc/NetworkManager/conf.d/
file_type: file
patterns: "*.conf"
register: __network_nm_config_active
changed_when: False
failed_when: False
- name: Remove unmanaged NetworkManager configuration
file:
path: "{{ item }}"
state: absent
loop: "{{ __network_nm_config_active.files | map(attribute='path') | list }}"
notify: __network_host_reboot
when: (item | basename | splitext | first) not in (network_nm_config | dict2items | map(attribute='key') | list)
become: True
become_user: root