Prefix module doesn't discern between identically named vlans from different vlan groups and/or sites #913
Replies: 4 comments 3 replies
-
Can you share the relevant sections of your playbook and traceback? I have multiple sites at work with vlan and vlan groups, and multiple prefixes, and have not encountered this error, however our playbooks may differ in how we reference things. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Looking at my playbooks, I was setting the following for a - name: Create netbox prefixes for each CCP function
netbox_prefix:
netbox_url: "{{ netbox_url }}"
netbox_token: "{{ netbox_token }}"
data:
site: "{{ netbox_site_slug }}"
prefix: "{{ item.prefix }}"
description: "{{ item.description }}"
vlan:
name: "{{ item.vlan_name | default(omit) }}"
vlan_group: "{{ item.vlan_group | default(omit) }}"
tags:
- "{{ az_tag }}"
prefix_role: "{{ item.role }}"
state: present
loop: "{{ ccp_vlans_subnets }}"
# some vlans don't have prefixes, so only create a prefix
# if one is defined
when: "'prefix' in item" I believe you need to set the |
Beta Was this translation helpful? Give feedback.
-
And how does one know that the vlan key in fact has two additional subkeys, if you don't mind my asking? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Ansible NetBox Collection version
v3.9.0
Ansible version
Running in AWX. Version is irrelevant to the case.
NetBox version
v3.3.7
Python version
3.8
Steps to Reproduce
netbox.netbox.netbox_prefix module doesn't have a way to specify vlans from specific vlan groups and/or sites, which in turn means that when you have identical vlan names in different vlan groups and/or sitesthe module will give the following error:
"msg": "More than one result returned for vlan"
Expected Behavior
There should be a way to specify exact the vlan from a specific vlan groups and/or sites.
If Netbox functionality and logic, allows this, the module should reflect it.
Observed Behavior
Got a "failed" status with the following message:
"msg": "More than one result returned for vlan"
Beta Was this translation helpful? Give feedback.
All reactions