Replies: 1 comment
-
Was this accidentally closed? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The same playbook worked when change netbox collection version to 3.10.0. If I kept v3.10.0, the add netbox_device would fail. Try different version of netbox collection from 3.10.0 to 3.17.0, but could not find a version worked for both tasks.
ansible --version
ansible [core 2.15.9]
config file = /home/xxxx/ansible/ansible-devices2netbox/ansible.cfg
configured module search path = ['/home/xxxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/xxxx/ansible/ansible-venv/lib64/python3.9/site-packages/ansible
ansible collection location = /home/xxxx/.ansible/collections:/usr/share/ansible/collections
executable location = /home/xxxx/ansible/ansible-venv/bin/ansible
python version = 3.9.18 (main, Sep 22 2023, 17:58:34) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] (/home/xxxx/ansible/ansible-venv/bin/python3)
jinja version = 3.1.3
libyaml = True
pip list | grep ansible
ansible 3.4.0
ansible-base 2.10.17
ansible-compat 4.1.11
ansible-core 2.15.9
ansible-lint 6.22.2
ansible-pylibssh 1.1.0
ansible-galaxy collection list
/home/xxxx/.ansible/collections/ansible_collections
Collection Version
ansible.netcommon 6.0.0
ansible.utils 3.1.0
cisco.ios 6.1.3
cisco.nxos 4.0.1
community.general 8.4.0
ibm.operator_collection_sdk 1.1.1
netbox.netbox 3.15.0
netbox.netbox.netbox_device_interface:
netbox_url: "{{ NETBOX_URL }}"
netbox_token: "{{ NETBOX_TOKEN }}"
data:
device: "{{ item.1.device.name }}"
name: "{{ item.1.name }}"
type: "{{ item.1.type.value }}"
state: absent
validate_certs: false
delegate_to: localhost
with_subelements:
when:
Read vars_file 'group_vars/device_maps.yml'
Read vars_file 'group_vars/secret.yml'
Read vars_file 'group_vars/vars.yml'
redirecting (type: become) ansible.builtin.enable to ansible.netcommon.enable
EXEC /bin/sh -c '( umask 77 && mkdir -p "
echo /home/xxxx/.ansible/tmp/ansible-local-38307806q2b2s6f
"&& mkdir "echo /home/xxxx/.ansible/tmp/ansible-local-38307806q2b2s6f/ansible-tmp-1710698197.3244925-3831041-265029785410244
" && echo ansible-tmp-1710698197.3244925-3831041-265029785410244="echo /home/xxxx/.ansible/tmp/ansible-local-38307806q2b2s6f/ansible-tmp-1710698197.3244925-3831041-265029785410244
" ) && sleep 0'Using module file /home/xxxx/.ansible/collections/ansible_collections/netbox/netbox/plugins/modules/netbox_device_interface.py
PUT /home/xxxx/.ansible/tmp/ansible-local-38307806q2b2s6f/tmps8h37el1 TO /home/xxxx/.ansible/tmp/ansible-local-38307806q2b2s6f/ansible-tmp-1710698197.3244925-3831041-265029785410244/AnsiballZ_netbox_device_interface.py
EXEC /bin/sh -c 'chmod u+x /home/xxxx/.ansible/tmp/ansible-local-38307806q2b2s6f/ansible-tmp-1710698197.3244925-3831041-265029785410244/ /home/xxxx/.ansible/tmp/ansible-local-38307806q2b2s6f/ansible-tmp-1710698197.3244925-3831041-265029785410244/AnsiballZ_netbox_device_interface.py && sleep 0'
EXEC /bin/sh -c '/home/xxxx/ansible/ansible-venv/bin/python3 /home/xxxx/.ansible/tmp/ansible-local-38307806q2b2s6f/ansible-tmp-1710698197.3244925-3831041-265029785410244/AnsiballZ_netbox_device_interface.py && sleep 0'
EXEC /bin/sh -c 'rm -f -r /home/xxxx/.ansible/tmp/ansible-local-38307806q2b2s6f/ansible-tmp-1710698197.3244925-3831041-265029785410244/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
File "/tmp/ansible_netbox.netbox.netbox_device_interface_payload_46924gjx/ansible_netbox.netbox.netbox_device_interface_payload.zip/ansible_collections/netbox/netbox/plugins/module_utils/netbox_utils.py", line 761, in _nb_endpoint_get
response = nb_endpoint.get(**query_params)
File "/home/xxxx/ansible/ansible-venv/lib64/python3.9/site-packages/pynetbox/core/endpoint.py", line 166, in get
raise ValueError(
failed: [usnpa-f-idfsw01 -> localhost] (item=[{'redirected': False, 'url': 'https://netbox.company.com//api/dcim/interfaces/?device=usnpa-f-idfsw01.3&limit=100', 'status': 200, 'date': 'Sun, 17 Mar 2024 17:54:53 GMT', 'server': 'gunicorn', 'content_type': 'application/json', 'vary': 'HX-Request,Cookie,origin', 'allow': 'GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, TRACE', 'x_request_id': '37f200fc-20da-4a08-abea-d92518c23bc3', 'api_version': '3.7', 'x_content_type_options': 'nosniff', 'referrer_policy': 'same-origin', 'cross_origin_opener_policy': 'same-origin', 'x_frame_options': 'SAMEORIGIN', 'content_length': '42318', 'connection': 'close', 'cookies_string': '', 'cookies': {}, 'msg': 'OK (42318 bytes)', 'elapsed': 0, 'changed': False, 'json': {'count': 37, 'next': None, 'previous': None}, 'invocation': {'module_args': {'url': 'https://netbox.company.com//api/dcim/interfaces/?device=usnpa-f-idfsw01.3&limit=100', 'headers': {'Content-Type': 'application/json', 'Authorization': 'token 06fa23907ebc12085bc05473b1300243252065b0'}, 'method': 'GET', 'status_code': [200], 'validate_certs': False, 'force': False, 'http_agent': 'ansible-httpget', 'use_proxy': True, 'force_basic_auth': False, 'use_gssapi': False, 'body_format': 'raw', 'return_content': False, 'follow_redirects': 'safe', 'timeout': 30, 'remote_src': False, 'unredirected_headers': [], 'decompress': True, 'use_netrc': True, 'unsafe_writes': False, 'url_username': None, 'url_password': None, 'client_cert': None, 'client_key': None, 'dest': None, 'body': None, 'src': None, 'creates': None, 'removes': None, 'unix_socket': None, 'ca_path': None, 'ciphers': None, 'mode': None, 'owner': None, 'group': None, 'seuser': None, 'serole': None, 'selevel': None, 'setype': None, 'attributes': None}}, 'failed': False, 'item': 'WS-C3850-12X48U', 'ansible_loop_var': 'item', 'idx': 2, 'ansible_index_var': 'idx'}, {'id': 17441, 'url': 'https://netbox.company.com/api/dcim/interfaces/17441/', 'display': 'GigabitEthernet1/0/36', 'device': {'id': 543, 'url': 'https://netbox.company.com/api/dcim/devices/543/', 'display': 'usnpa-f-idfsw01.3', 'name': 'usnpa-f-idfsw01.3'}, 'vdcs': [], 'module': None, 'name': 'GigabitEthernet1/0/36', 'label': '', 'type': {'value': '1000base-t', 'label': '1000BASE-T (1GE)'}, 'enabled': True, 'parent': None, 'bridge': None, 'lag': None, 'mtu': None, 'mac_address': None, 'speed': None, 'duplex': None, 'wwn': None, 'mgmt_only': False, 'description': '', 'mode': None, 'rf_role': None, 'rf_channel': None, 'poe_mode': None, 'poe_type': None, 'rf_channel_frequency': None, 'rf_channel_width': None, 'tx_power': None, 'untagged_vlan': None, 'tagged_vlans': [], 'mark_connected': False, 'cable': None, 'cable_end': '', 'wireless_link': None, 'link_peers': [], 'link_peers_type': None, 'wireless_lans': [], 'vrf': None, 'l2vpn_termination': None, 'connected_endpoints': None, 'connected_endpoints_type': None, 'connected_endpoints_reachable': None, 'tags': [], 'custom_fields': {}, 'created': '2024-01-10T18:08:50.777953Z', 'last_updated': '2024-01-10T18:08:50.777958Z', 'count_ipaddresses': 0, 'count_fhrp_groups': 0, '_occupied': False}]) => {
"ansible_loop_var": "item",
"changed": false,
"invocation": {
"module_args": {
"cert": null,
"data": {
"bridge": null,
"custom_fields": null,
"description": null,
"device": "usnpa-f-idfsw01.3",
"duplex": null,
"enabled": null,
"form_factor": null,
"label": null,
"lag": null,
"mac_address": null,
"mark_connected": null,
"mgmt_only": null,
"mode": null,
"mtu": null,
"name": "GigabitEthernet1/0/36",
"parent_interface": null,
"poe_mode": null,
"poe_type": null,
"speed": null,
"tagged_vlans": null,
"tags": null,
"tx_power": null,
"type": "1000base-t",
"untagged_vlan": null,
"vrf": null,
"wwn": null
},
"netbox_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"netbox_url": "https://netbox.company.com/",
"query_params": null,
"state": "absent",
"update_vc_child": false,
"validate_certs": false
}
},
"item": [
{
"allow": "GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, TRACE",
"ansible_index_var": "idx",
"ansible_loop_var": "item",
"api_version": "3.7",
"changed": false,
"connection": "close",
"content_length": "42318",
"content_type": "application/json",
"cookies": {},
"cookies_string": "",
"cross_origin_opener_policy": "same-origin",
"date": "Sun, 17 Mar 2024 17:54:53 GMT",
"elapsed": 0,
"failed": false,
"idx": 2,
"invocation": {
"module_args": {
"attributes": null,
"body": null,
"body_format": "raw",
"ca_path": null,
"ciphers": null,
"client_cert": null,
"client_key": null,
"creates": null,
"decompress": true,
"dest": null,
"follow_redirects": "safe",
"force": false,
"force_basic_auth": false,
"group": null,
"headers": {
"Authorization": "token 06fa23907ebc12085bc05473b1300243252065b0",
"Content-Type": "application/json"
},
"http_agent": "ansible-httpget",
"method": "GET",
"mode": null,
"owner": null,
"remote_src": false,
"removes": null,
"return_content": false,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"status_code": [
200
],
"timeout": 30,
"unix_socket": null,
"unredirected_headers": [],
"unsafe_writes": false,
"url": "https://netbox.company.com//api/dcim/interfaces/?device=usnpa-f-idfsw01.3&limit=100",
"url_password": null,
"url_username": null,
"use_gssapi": false,
"use_netrc": true,
"use_proxy": true,
"validate_certs": false
}
},
"item": "WS-C3850-12X48U",
"json": {
"count": 37,
"next": null,
"previous": null
},
"msg": "OK (42318 bytes)",
"redirected": false,
"referrer_policy": "same-origin",
"server": "gunicorn",
"status": 200,
"url": "https://netbox.company.com//api/dcim/interfaces/?device=usnpa-f-idfsw01.3&limit=100",
"vary": "HX-Request,Cookie,origin",
"x_content_type_options": "nosniff",
"x_frame_options": "SAMEORIGIN",
"x_request_id": "37f200fc-20da-4a08-abea-d92518c23bc3"
},
{
"_occupied": false,
"bridge": null,
"cable": null,
"cable_end": "",
"connected_endpoints": null,
"connected_endpoints_reachable": null,
"connected_endpoints_type": null,
"count_fhrp_groups": 0,
"count_ipaddresses": 0,
"created": "2024-01-10T18:08:50.777953Z",
"custom_fields": {},
"description": "",
"device": {
"display": "usnpa-f-idfsw01.3",
"id": 543,
"name": "usnpa-f-idfsw01.3",
"url": "https://netbox.company.com/api/dcim/devices/543/"
},
"display": "GigabitEthernet1/0/36",
"duplex": null,
"enabled": true,
"id": 17441,
"l2vpn_termination": null,
"label": "",
"lag": null,
"last_updated": "2024-01-10T18:08:50.777958Z",
"link_peers": [],
"link_peers_type": null,
"mac_address": null,
"mark_connected": false,
"mgmt_only": false,
"mode": null,
"module": null,
"mtu": null,
"name": "GigabitEthernet1/0/36",
"parent": null,
"poe_mode": null,
"poe_type": null,
"rf_channel": null,
"rf_channel_frequency": null,
"rf_channel_width": null,
"rf_role": null,
"speed": null,
"tagged_vlans": [],
"tags": [],
"tx_power": null,
"type": {
"label": "1000BASE-T (1GE)",
"value": "1000base-t"
},
"untagged_vlan": null,
"url": "https://netbox.company.com/api/dcim/interfaces/17441/",
"vdcs": [],
"vrf": null,
"wireless_lans": [],
"wireless_link": null,
"wwn": null
}
],
"msg": "More than one result returned for GigabitEthernet1/0/36"
}
Beta Was this translation helpful? Give feedback.
All reactions