xoxys.network/tasks/nm.yml
Robert Kaussow 233cf83f87
All checks were successful
continuous-integration/drone/push Build is passing
feat: add option to manage networkmanager config files
2022-11-11 21:51:36 +01:00

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