diff --git a/defaults/main.yaml b/defaults/main.yaml index 2e45245..ad50cff 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -2,3 +2,6 @@ # use 'network-scripts' for network-scripts and lo iface for BGP IPs network: "nm" network_nm_iface: "dummy0" + +# null for auto +network_nm_iface_mtu: null diff --git a/tasks/RedHat/8.yaml b/tasks/RedHat/8.yaml index e187143..81bd984 100644 --- a/tasks/RedHat/8.yaml +++ b/tasks/RedHat/8.yaml @@ -18,23 +18,28 @@ - Restart loopback when: network == 'network-scripts' -- name: Add dummy interface and add IPs - community.general.nmcli: - type: dummy - conn_name: "{{ network_nm_iface }}" - ip4: | - [ - {% set ips = [] %} - {% for protocol_static in bird.bgp.static %} - {% for network in protocol_static['networks'][ansible_fqdn] %} - {{ ips.append(network['ip'] + '/' + network['mask_dash']) }} - {% endfor %} - {% endfor %} - "{{ ips | join(',') }}" - ] - state: present - notify: - - Reload dummy interface + +- block: + - name: BGP IPs string for nmcli + set_fact: + ips: |- + {%- set ips_list = [] %} + {%- for protocol_static in bird.bgp.static %} + {%- for network in protocol_static['networks'][ansible_fqdn] %} + {{ ips_list.append(network['ip'] + '/' + network['mask_dash']) }} + {%- endfor %} + {%- endfor %} + {{ ips_list | join(', ') }} + + - name: Add dummy interface and add IPs + community.general.nmcli: + type: dummy + conn_name: "{{ network_nm_iface }}" + ip4: "{{ ips }}" + mtu: "{{ network_nm_iface_mtu }}" + state: present + notify: + - Reload dummy interface when: network == 'nm' - name: Add BIRD config @@ -50,4 +55,3 @@ state: started enabled: yes daemon_reload: yes -