aristanetworks / avd

Arista Validated Designs
https://avd.arista.com
Apache License 2.0
278 stars 201 forks source link

loopback_ipv4_address under node: not resolve the variable input #4370

Open jixh99 opened 3 weeks ago

jixh99 commented 3 weeks ago

Issue Summary

The dict key "loopback_ipv4_address" not resolve the inputs as variable, while other keys do, like "mgmt_ip" and "bgp_as".

the AVD inputs:

l3leaf: defaults: platform: cEOS loopback_ipv4_pool: "{{ NETv4_LPBK_ULAY }}" loopback_ipv4_offset: 0 ... nodes:

Generate CFG

interface Loopback0 description EVPN_Overlay_Peering no shutdown ip address {{ NETv4_LPBK_ULAY | ansible.utils.ipaddr(2) | ansible.utils.ipaddr(address) }}/32 !

Which component(s) of AVD impacted

eos_cli_config_gen

How do you run AVD ?

Ansible CLI (with virtual-env or native python)

Steps to reproduce

# L3 Leaf switch group
l3leaf:
  defaults:
    platform: cEOS
    loopback_ipv4_pool: "{{ NETv4_LPBK_ULAY }}"
    loopback_ipv4_offset: 0
    vtep_loopback_ipv4_pool: "{{ NETv4_LPBK_OLAY }}"
    uplink_switches: ['spine01', 'spine02']
    uplink_ipv4_pool: "{{ NETv4_PTP }}"
    virtual_router_mac_address: 00:1c:73:{{'%02d' % rack_id}}:{{'%02d' % rack_id}}:99
    spanning_tree_priority: 4096
    spanning_tree_mode: mstp

  nodes:
    - name: cleaf01
      id: 1
      loopback_ipv4_address: "{{ NETv4_LPBK_ULAY | ansible.utils.ipaddr(2) | ansible.utils.ipaddr(address) }}"
      mgmt_ip: "{{NETv4_MGMTA | ansible.utils.ipaddr(seq_id) }}"
      bgp_as: "{{ bgp_asn_base + dc_id*100 + seq_id }}"
      uplink_switch_interfaces:
        - Ethernet1
        - Ethernet1

Relevant log output

interface Loopback0
   description EVPN_Overlay_Peering
   no shutdown
   ip address {{ NETv4_LPBK_ULAY | ansible.utils.ipaddr(2) | ansible.utils.ipaddr(address) }}/32
!

Contributing Guide

ClausHolbechArista commented 3 weeks ago

My guess is that address needs to be enclosed in single quotes to be picked up as a string instead of an undefined variable. Unfortunately Ansible stops templating of vars (silently) if any errors are hit.

ClausHolbechArista commented 3 weeks ago

Recreating the issue with https://ansible.sivel.net/test/: image

Working example: image