net interfaces: try to clean up the list.
This commit is contained in:
parent
1cd1cb8ab3
commit
86bcff6d7b
|
@ -13,11 +13,11 @@
|
|||
register: netplan_in_use
|
||||
- name: network-interfaces | Check if additional interfaces have been defined
|
||||
ansible.builtin.set_fact:
|
||||
net_ints: "{% for i in ansible_interfaces %}{% if i != ansible_lo.device and i != ansible_default_ipv4.interface %}{{ i }}{% if not loop.last %},{% endif %}{% endif %}{% endfor %}"
|
||||
net_ints: "{% for i in ansible_interfaces %}{% if i != ansible_lo.device and i != ansible_default_ipv4.interface %}{{ i }}{% endif %}{% if not loop.last %},{% endif %}{% endfor %}"
|
||||
when: netplan_in_use.stat.isdir
|
||||
- name: network-interfaces | Create a dictionary of additional interfaces
|
||||
ansible.builtin.set_fact:
|
||||
new_ints: "[{% for i in ansible_interfaces %}{% if i != ansible_lo.device and i != ansible_default_ipv4.interface %}{{ i }}{% if not loop.last %},{% endif %}{% endif %}{% endfor %}]"
|
||||
new_ints: "[{% for i in ansible_interfaces %}{% if i != ansible_lo.device and i != ansible_default_ipv4.interface %}{{ i }}{% endif %}{% if not loop.last %},{% endif %}{% endfor %}]"
|
||||
when: net_ints is defined and net_ints | length != 0
|
||||
- name: network-interfaces | Print the loopback interface name
|
||||
ansible.builtin.debug:
|
||||
|
|
Loading…
Reference in New Issue