Netbox.netbox Ansible API add devices to virtual chassis error -> "More than one result returned for virtual_chassis" #4394

Closed
opened 2025-12-29 18:35:33 +01:00 by adam · 2 comments
Owner

Originally created by @jefvantongerloo on GitHub (Dec 22, 2020).

Environment

  • NetBox-Docker version: 0.27.0
  • NetBox version: 2.9.9 (worked) & 2.10.2 (bugged)

Adding devices to a virtual chassis through the Ansible netbox.netbox collection gives an error on the second device/chassis added to the same virtual chassis: "More than one result returned for virtual_chassis". Error first seen in version 2.10.2, Downgraded to version 2.9.9 and confirmed to be working.

Sample inventory:

    SWITCH-001:
      ansible_host: 10.10.10.1
      device_role: Access Switch
      device_chassis:
        - type: OS6560-P48X4
          unit: 1
        - type: OS6560-P48X4
          unit: 2
        - type: OS6560-P48X4
          unit: 3

Playbook:

   - name: Create virtual chassis
      netbox_virtual_chassis:
        netbox_url: '{{ netbox_url }}'
        netbox_token: '{{ netbox_token }}'
        data:
          name: '{{ inventory_hostname }}'
          master: '{{ inventory_hostname + "-1" }}'
        state: present
    - name: Add devices to Virtual chassis
      netbox_device:
        netbox_url: '{{ netbox_url }}'
        netbox_token: '{{ netbox_token }}'
        data:
          name: '{{ inventory_hostname + "-" + item.unit|string }}'
          virtual_chassis: '{{ inventory_hostname }}'
          vc_position: '{{ item.unit}}'
      loop: '{{ device_chassis  }}'

Steps to Reproduce

  1. Ansible: add device through netbox.netbox.netbox_device module
  2. Ansible: create virtual chassis through netbox.netbox.netbox_virtual_chassis module
  3. Ansible: update devices to add them to virtual chassis through netbox.netbox.netbox_device module

What did you expect to happen?
One virtual chassis with three added chassis/devices linked

What happened instead?
Version 2.9.9: worked fine
Version 2.10.2: Ansible error and only two chassis/devices added to virtual chassis.

Originally created by @jefvantongerloo on GitHub (Dec 22, 2020). ### Environment * NetBox-Docker version: 0.27.0 * NetBox version: 2.9.9 (worked) & 2.10.2 (bugged) Adding devices to a virtual chassis through the Ansible netbox.netbox collection gives an error on the second device/chassis added to the same virtual chassis: "More than one result returned for virtual_chassis". Error first seen in version 2.10.2, Downgraded to version 2.9.9 and confirmed to be working. **Sample inventory:** ``` SWITCH-001: ansible_host: 10.10.10.1 device_role: Access Switch device_chassis: - type: OS6560-P48X4 unit: 1 - type: OS6560-P48X4 unit: 2 - type: OS6560-P48X4 unit: 3 ``` **Playbook:** ``` - name: Create virtual chassis netbox_virtual_chassis: netbox_url: '{{ netbox_url }}' netbox_token: '{{ netbox_token }}' data: name: '{{ inventory_hostname }}' master: '{{ inventory_hostname + "-1" }}' state: present ``` ``` - name: Add devices to Virtual chassis netbox_device: netbox_url: '{{ netbox_url }}' netbox_token: '{{ netbox_token }}' data: name: '{{ inventory_hostname + "-" + item.unit|string }}' virtual_chassis: '{{ inventory_hostname }}' vc_position: '{{ item.unit}}' loop: '{{ device_chassis }}' ``` ### Steps to Reproduce 1. Ansible: add device through netbox.netbox.netbox_device module 2. Ansible: create virtual chassis through netbox.netbox.netbox_virtual_chassis module 3. Ansible: update devices to add them to virtual chassis through netbox.netbox.netbox_device module **What did you expect to happen?** One virtual chassis with three added chassis/devices linked **What happened instead?** Version 2.9.9: worked fine Version 2.10.2: Ansible error and only two chassis/devices added to virtual chassis.
adam closed this issue 2025-12-29 18:35:33 +01:00
Author
Owner

@jeremystretch commented on GitHub (Dec 22, 2020):

I'm sorry but we require bug reports to be reproducible using only NetBox itself and/or raw HTTP requests. Additionally, we do not provide support for Docker images. Please rewrite your issue so that it can be reproduced without using Ansible or any other external tools that might contribute to the reported behavior.

@jeremystretch commented on GitHub (Dec 22, 2020): I'm sorry but we require bug reports to be reproducible using only NetBox itself and/or raw HTTP requests. Additionally, we do not provide support for Docker images. Please rewrite your issue so that it can be reproduced without using Ansible or any other external tools that might contribute to the reported behavior.
Author
Owner

@jeremystretch commented on GitHub (Jan 7, 2021):

Closing due to lack of activity.

@jeremystretch commented on GitHub (Jan 7, 2021): Closing due to lack of activity.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4394