30 lines
921 B
YAML
30 lines
921 B
YAML
---
|
|
- name: Add NetworkManager configuration
|
|
ansible.builtin.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
|
|
ansible.builtin.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
|
|
ansible.builtin.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)
|