Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap without dhcp enabled #274

Open
ccoueffe opened this issue Feb 3, 2025 · 0 comments
Open

Bootstrap without dhcp enabled #274

ccoueffe opened this issue Feb 3, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@ccoueffe
Copy link
Collaborator

ccoueffe commented Feb 3, 2025

Ansible Version

❯ ansible --version
ansible [core 2.17.5]

Ansible Collection Versions

Collection         Version
------------------ -------
ansible.netcommon  5.3.0  
ansible.posix      1.5.4  
ansible.utils      2.11.0 
cisco.dcnm         3.5.1  
cisco.nac_dc_vxlan 0.3.0  
cisco.nxos         5.3.0  
community.general  8.5.0

Cisco NDFC Version

Version 12.2.2.241

Cisco NX-OS Version

10.4.2

Which role is this issue related to?

cisco.nac_dc_vxlan.dtc.create

Which section of the data model is this issue related to?

vxlan.global

Expected Behavior

The goal is to be able to have bootstrap enabled without DHCP parameters.

Actual Behavior

Even when ``enable_local_dhcp_server`` is set to False, you need to provide dhcp_version , etc.


    bootstrap:
      enable_bootstrap: true
      enable_local_dhcp_server: false
      dhcp_version: DHCPv4

Ansible Playbook

---
vxlan:
  fabric:
    name: nac-ndfc3
    type: VXLAN_EVPN
  global:
    name: nac-ndfc3
    bgp_asn: "65000.3"
    route_reflectors: 2
    anycast_gateway_mac: 12:34:56:78:90:00
    enable_nxapi_http: false
    bootstrap:
      enable_bootstrap: true
      enable_local_dhcp_server: false
      dhcp_version: DHCPv4

Steps to Reproduce

run ansible-playbook

Relevant Debug Output

ASK [cisco.nac_dc_vxlan.common : Build Fabric Creation Parameters From Template
The full traceback is:
Traceback (most recent call last):
  File "/Users/ccoueffe/.pyenv/versions/3.11.10/envs/sac-ndfc/lib/python3.11/site-packages/ansible/template/__init__.py", line 993, in do_template
    res = myenv.concat(rf)
          ^^^^^^^^^^^^^^^^
  File "/Users/ccoueffe/.pyenv/versions/3.11.10/envs/sac-ndfc/lib/python3.11/site-packages/ansible/template/native_helpers.py", line 81, in ansible_concat
    return ''.join([to_text(v) for v in nodes])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ccoueffe/.pyenv/versions/3.11.10/envs/sac-ndfc/lib/python3.11/site-packages/ansible/template/native_helpers.py", line 81, in <listcomp>
    return ''.join([to_text(v) for v in nodes])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<template>", line 22, in root
  File "/Users/ccoueffe/Documents/sac-ndfc/nac-ndfc/collections/ansible_collections/cisco/nac_dc_vxlan/roles/dtc/common/templates/ndfc_fabric/dc_vxlan_fabric/dc_vxlan_fabric_base.j2", line 62, in root
  File "/Users/ccoueffe/Documents/sac-ndfc/nac-ndfc/collections/ansible_collections/cisco/nac_dc_vxlan/roles/dtc/common/templates/ndfc_fabric/dc_vxlan_fabric/bootstrap/dc_vxlan_fabric_bootstrap.j2", line 29, in root
  File "/Users/ccoueffe/.pyenv/versions/3.11.10/envs/sac-ndfc/lib/python3.11/site-packages/ansible/template/__init__.py", line 294, in wrapper
    ret = func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ccoueffe/.pyenv/versions/3.11.10/envs/sac-ndfc/lib/python3.11/site-packages/ansible/template/__init__.py", line 541, in _ansible_finalize
    return thing if _fail_on_undefined(thing) is not None else ''
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ccoueffe/.pyenv/versions/3.11.10/envs/sac-ndfc/lib/python3.11/site-packages/ansible/template/__init__.py", line 513, in _fail_on_undefined
    elif is_sequence(data):
         ^^^^^^^^^^^^^^^^^
  File "/Users/ccoueffe/.pyenv/versions/3.11.10/envs/sac-ndfc/lib/python3.11/site-packages/ansible/module_utils/common/collections.py", line 93, in is_sequence
    if not include_strings and is_string(seq):
  File "/Users/ccoueffe/.pyenv/versions/3.11.10/envs/sac-ndfc/lib/python3.11/site-packages/jinja2/runtime.py", line 857, in _fail_with_undefined_error
    raise self._undefined_exception(self._undefined_message)
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'dhcp_v4'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ccoueffe/.pyenv/versions/3.11.10/envs/sac-ndfc/lib/python3.11/site-packages/ansible/plugins/action/template.py", line 151, in run
    resultant = templar.do_template(template_data, preserve_trailing_newlines=True, escape_backslashes=False, overrides=overrides)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ccoueffe/.pyenv/versions/3.11.10/envs/sac-ndfc/lib/python3.11/site-packages/ansible/template/__init__.py", line 1027, in do_template
    raise AnsibleUndefinedVariable(e)
ansible.errors.AnsibleUndefinedVariable: 'dict object' has no attribute 'dhcp_v4'
fatal: [nac-ndfc3 -> localhost]: FAILED! => changed=false 
  msg: 'AnsibleUndefinedVariable: ''dict object'' has no attribute ''dhcp_v4'''
@ccoueffe ccoueffe added the bug Something isn't working label Feb 3, 2025
@peter8498 peter8498 self-assigned this Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants