Fix the conditional in the template task.

This commit is contained in:
Andrea Dell'Amico 2023-12-05 18:12:11 +01:00
parent 1eef42b417
commit 315acd9c9f
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
1 changed files with 6 additions and 2 deletions

View File

@ -25,13 +25,17 @@
- name: network-interfaces | Print the name of the default interface - name: network-interfaces | Print the name of the default interface
ansible.builtin.debug: ansible.builtin.debug:
msg: "Loopback interface: {{ ansible_default_ipv4.interface }}" msg: "Loopback interface: {{ ansible_default_ipv4.interface }}"
- name: network-interfaces | Print the additional interfaces - name: network-interfaces | List of interfaces other than the default one
ansible.builtin.debug: ansible.builtin.debug:
msg: "Interfaces list: {{ new_ints }}" msg: "Interfaces list: {{ new_ints }}"
- name: network-interfaces | Override the interfaces list - name: network-interfaces | Override the interfaces list
ansible.builtin.set_fact: ansible.builtin.set_fact:
new_ints: "{{ ubuntu_configure_additional_ints_list }}" new_ints: "{{ ubuntu_configure_additional_ints_list }}"
when: ubuntu_configure_additional_ints_list | length != 0 when: ubuntu_configure_additional_ints_list | length != 0
- name: network-interfaces | List of interfaces that we are going to configure
ansible.builtin.debug:
msg: "Interfaces list: {{ new_ints }}"
when: ubuntu_configure_additional_ints_list | length != 0
- name: network-interfaces | Install the network interface file - name: network-interfaces | Install the network interface file
ansible.builtin.template: ansible.builtin.template:
src: netplan-70-ansible.yaml.j2 src: netplan-70-ansible.yaml.j2
@ -39,7 +43,7 @@
owner: root owner: root
group: root group: root
mode: "0644" mode: "0644"
when: ubuntu_netplan_interfaces is defined and ubuntu_netplan_interfaces | length != 0 when: new_ints | length != 0
notify: Netplan Apply notify: Netplan Apply
- name: network-interfaces | Force the Netplan Apply command execution - name: network-interfaces | Force the Netplan Apply command execution