Closed erics302 closed 3 months ago
v3.19.1
ansible [core 2.16.0] config file = /etc/ansible/ansible.cfg configured module search path = ['/home/eric/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.12/site-packages/ansible ansible collection location = /home/eric/.ansible/collections:/usr/share/ansible/collections executable location = /usr/bin/ansible python version = 3.12.0 (main, Oct 2 2023, 00:00:00) [GCC 13.2.1 20230918 (Red Hat 13.2.1-3)] (/usr/bin/python3) jinja version = 3.1.2 libyaml = True
v3.7.8
3.11
- name: Create device with location netbox.netbox.netbox_device: netbox_url: "{{ nb_url }}" netbox_token: "{{ nb_token }}" data: name: "Floor 1 Camera" device_type: "Cam-A1" device_role: "Security Camera" site: "Site A" location: "Floor 1" state: present
Device is created (or updated) successfully with all applicable attributes.
TASK [Create device with location] **************************************************************************************** task path: /home/eric/repo/sandbox/netbox/netbox_device_loc_bug.yml:8 <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: eric <127.0.0.1> EXEC /bin/sh -c 'echo ~eric && sleep 0' <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/eric/.ansible/tmp `"&& mkdir "` echo /home/eric/.ansible/tmp/ansible-tmp-1717422323.5876143-143631-252728154399277 `" && echo ansible-tmp-1717422323.5876143-143631-252728154399277="` echo /home/eric/.ansible/tmp/ansible-tmp-1717422323.5876143-143631-252728154399277 `" ) && sleep 0' Using module file /home/eric/.ansible/collections/ansible_collections/netbox/netbox/plugins/modules/netbox_device.py <127.0.0.1> PUT /home/eric/.ansible/tmp/ansible-local-1436288pbnwc5r/tmpk8tj53en TO /home/eric/.ansible/tmp/ansible-tmp-1717422323.5876143-143631-252728154399277/AnsiballZ_netbox_device.py <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/eric/.ansible/tmp/ansible-tmp-1717422323.5876143-143631-252728154399277/ /home/eric/.ansible/tmp/ansible-tmp-1717422323.5876143-143631-252728154399277/AnsiballZ_netbox_device.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3 /home/eric/.ansible/tmp/ansible-tmp-1717422323.5876143-143631-252728154399277/AnsiballZ_netbox_device.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/eric/.ansible/tmp/ansible-tmp-1717422323.5876143-143631-252728154399277/ > /dev/null 2>&1 && sleep 0' The full traceback is: File "/tmp/ansible_netbox.netbox.netbox_device_payload_qlc4q3qf/ansible_netbox.netbox.netbox_device_payload.zip/ansible_collections/netbox/netbox/plugins/module_utils/netbox_utils.py", line 795, in _nb_endpoint_get response = nb_endpoint.get(**query_params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/eric/.local/lib/python3.12/site-packages/pynetbox/core/endpoint.py", line 166, in get raise ValueError( fatal: [localhost]: FAILED! => { "changed": false, "invocation": { "module_args": { "cert": null, "data": { "airflow": null, "asset_tag": null, "cluster": null, "comments": null, "config_template": null, "custom_fields": null, "description": null, "device_role": "Security Camera", "device_type": "Cam-A1", "face": null, "local_context_data": null, "location": "Floor 1", "name": "Floor 1 Camera", "oob_ip": null, "platform": null, "position": null, "primary_ip4": null, "primary_ip6": null, "rack": null, "serial": null, "site": "Site A", "status": null, "tags": null, "tenant": null, "vc_position": null, "vc_priority": null, "virtual_chassis": null }, "netbox_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "netbox_url": "REMOVED", "query_params": null, "state": "present", "validate_certs": false } }, "msg": "More than one result returned for location" }
You might need to set the parent location parameter. #1233
Ansible NetBox Collection version
v3.19.1
Ansible version
NetBox version
v3.7.8
Python version
3.11
Steps to Reproduce
Create two or more locations in Netbox that:
Use netbox.netbox.netbox_device to create a device in a location that meets the condition above
Expected Behavior
Device is created (or updated) successfully with all applicable attributes.
Observed Behavior