refactor(configuration): split network.yml into per-init-system dispatch files
This commit is contained in:
26
roles/configuration/tasks/network_nm.yml
Normal file
26
roles/configuration/tasks/network_nm.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
- name: Copy NetworkManager keyfile per interface
|
||||
vars:
|
||||
configuration_iface: "{{ item }}"
|
||||
configuration_iface_name: >-
|
||||
{{
|
||||
item.name
|
||||
if (item.name | default('') | string | length) > 0
|
||||
else (configuration_detected_interfaces[idx] | default('eth' ~ idx))
|
||||
}}
|
||||
configuration_net_uuid: "{{ ('LAN-' ~ idx ~ '-' ~ hostname) | ansible.builtin.to_uuid }}"
|
||||
ansible.builtin.template:
|
||||
src: network.j2
|
||||
dest: "/mnt/etc/NetworkManager/system-connections/LAN-{{ idx }}.nmconnection"
|
||||
mode: "0600"
|
||||
loop: "{{ system_cfg.network.interfaces }}"
|
||||
loop_control:
|
||||
index_var: idx
|
||||
label: "LAN-{{ idx }}"
|
||||
|
||||
- name: Fix Ubuntu unmanaged devices
|
||||
when: os in ["ubuntu", "ubuntu-lts"]
|
||||
ansible.builtin.file:
|
||||
path: /mnt/etc/NetworkManager/conf.d/10-globally-managed-devices.conf
|
||||
state: touch
|
||||
mode: "0644"
|
||||
Reference in New Issue
Block a user