correct outdated code.
This commit is contained in:
@@ -21,15 +21,43 @@
|
||||
tags:
|
||||
- network-interfaces
|
||||
|
||||
- name: (interfaces.yml) Build interface map by device
|
||||
ansible.builtin.set_fact:
|
||||
iface_map: "{{ iface_map | default({}) | combine({ item.device: (iface_map[item.device] | default([])) + [item] }) }}"
|
||||
loop: "{{ network_interfaces | default([]) }}"
|
||||
loop_control:
|
||||
label: "{{ item.device }}"
|
||||
tags: [network-interfaces]
|
||||
|
||||
- name: (interfaces.yml) Ensure imported device files at interfaces.d are latest
|
||||
template:
|
||||
src: "etc/network/interfaces.d/device.j2"
|
||||
dest: "{{ network_interface_path }}/device-{{ item.0 }}"
|
||||
with_items:
|
||||
- "{{network_interfaces | default([]) | groupby('device') }}"
|
||||
ansible.builtin.template:
|
||||
src: etc/network/interfaces.d/device.j2
|
||||
dest: "{{ network_interface_path }}/device-{{ grp.key }}"
|
||||
loop: "{{ iface_map | dict2items }}"
|
||||
loop_control:
|
||||
loop_var: grp
|
||||
register: network_configuration_result
|
||||
tags:
|
||||
- network-interfaces
|
||||
tags: [network-interfaces]
|
||||
|
||||
#- name: Ensure imported device files at interfaces.d are latest
|
||||
# ansible.builtin.template:
|
||||
# src: etc/network/interfaces.d/device.j2
|
||||
# dest: "{{ network_interface_path }}/device-{{ grp.0 }}"
|
||||
# loop: "{{ (network_interfaces | default([]) | groupby('device')) | list }}"
|
||||
# loop_control:
|
||||
# loop_var: grp
|
||||
# register: network_configuration_result
|
||||
# tags: [network-interfaces]
|
||||
|
||||
#- name: (interfaces.yml) Ensure imported device files at interfaces.d are latest
|
||||
# template:
|
||||
# src: "etc/network/interfaces.d/device.j2"
|
||||
# dest: "{{ network_interface_path }}/device-{{ item.0 }}"
|
||||
# with_items:
|
||||
# - "{{network_interfaces | default([]) | groupby('device') }}"
|
||||
# register: network_configuration_result
|
||||
# tags:
|
||||
# - network-interfaces
|
||||
|
||||
# ---
|
||||
# Remove device files not configured here
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{ ansible_managed | comment }}
|
||||
|
||||
{# {% for config in network_interfaces %} #}
|
||||
{% for config in item.1 %}
|
||||
{% for config in grp.value %}
|
||||
|
||||
{% if config.headline is defined and config.headline %}
|
||||
#-----------------------------
|
||||
|
||||
Reference in New Issue
Block a user