From 93c52d62231249dfad4d1b76c8094747de3c4b65 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 4 Dec 2023 12:20:46 +0100 Subject: [PATCH] The interfaces must be a list. --- tasks/network-interfaces.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/network-interfaces.yml b/tasks/network-interfaces.yml index f7a98d5..038e027 100644 --- a/tasks/network-interfaces.yml +++ b/tasks/network-interfaces.yml @@ -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 %}{% if not loop.last %},{% endif %}{% endfor %}" + 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 %}' 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 %}{% if not loop.last %},{% endif %}{% endfor %}]" + 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 %}]' when: net_ints is defined and net_ints | length != 0 - name: network-interfaces | Print the loopback interface name ansible.builtin.debug: