-
Notifications
You must be signed in to change notification settings - Fork 254
Closed
Labels
Description
ISSUE TYPE
- Bug Report
SOFTWARE VERSIONS
Ansible:
ansible 2.10.2
config file = None
configured module search path = ['/Users/***/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/***/p/issue-ansible-netbox-20201014/.direnv/python-3.8.5/lib/python3.8/site-packages/ansible
executable location = /Users/***/p/issue-ansible-netbox-20201014/.direnv/python-3.8.5/bin/ansible
python version = 3.8.5 (default, Sep 23 2020, 11:29:00) [Clang 10.0.1 (clang-1001.0.46.4)]
Netbox:
f6c7f1765189 (v2.9.7)
Collection:
# /Users/***/.ansible/collections/ansible_collections
Collection Version
-------------------- -------
ansible.netcommon 1.3.0
ansible.posix 1.1.1
community.general 1.2.0
community.kubernetes 1.1.1
google.cloud 1.0.1
netbox.netbox 1.1.0
SUMMARY
Unable to create netbox_cable in the case when termination_a_type is circuits.circuittermination.
STEPS TO REPRODUCE
---
- hosts: localhost
connection: local
gather_facts: no
vars:
netbox_url: "http://localhost:8000"
netbox_token: "0123456789abcdef0123456789abcdef01234567"
tasks:
- name: Create site
netbox.netbox.netbox_site:
netbox_url: '{{ netbox_url }}'
netbox_token: '{{ netbox_token }}'
data:
name: Site1
state: present
- name: Create manufacturer
netbox.netbox.netbox_manufacturer:
netbox_url: '{{ netbox_url }}'
netbox_token: '{{ netbox_token }}'
data:
name: Juniper
state: present
- name: Create device type
netbox.netbox.netbox_device_type:
netbox_url: '{{ netbox_url }}'
netbox_token: '{{ netbox_token }}'
data:
model: MX80
manufacturer: Juniper
state: present
- name: Create device role
netbox.netbox.netbox_device_role:
netbox_url: '{{ netbox_url }}'
netbox_token: '{{ netbox_token }}'
data:
name: Router
state: present
- name: Create device
netbox.netbox.netbox_device:
netbox_url: '{{ netbox_url }}'
netbox_token: '{{ netbox_token }}'
data:
name: Device1
device_role: Router
device_type: MX80
site: Site1
state: present
- name: Create interface
netbox.netbox.netbox_device_interface:
netbox_url: '{{ netbox_url }}'
netbox_token: '{{ netbox_token }}'
data:
device: Device1
name: ge-0/0/0
type: 1000base-t (1ge)
state: present
- name: Create provider
netbox.netbox.netbox_provider:
netbox_url: '{{ netbox_url }}'
netbox_token: '{{ netbox_token }}'
data:
name: Provider1
state: present
- name: Create circuit type
netbox.netbox.netbox_circuit_type:
netbox_url: '{{ netbox_url }}'
netbox_token: '{{ netbox_token }}'
data:
name: Internet transit
state: present
- name: Create circuit
netbox.netbox.netbox_circuit:
netbox_url: '{{ netbox_url }}'
netbox_token: '{{ netbox_token }}'
data:
circuit_type: Internet transit
provider: Provider1
cid: Circuit1
state: present
- name: Create circuit termination
netbox.netbox.netbox_circuit_termination:
netbox_url: '{{ netbox_url }}'
netbox_token: '{{ netbox_token }}'
data:
circuit: Circuit1
term_side: A
site: Site1
port_speed: 10000
state: present
- name: Create cable
netbox.netbox.netbox_cable:
netbox_url: '{{ netbox_url }}'
netbox_token: '{{ netbox_token }}'
data:
termination_a_type: circuits.circuittermination
termination_a:
cid: Circuit1
termination_b_type: dcim.interface
termination_b:
device: Device1
name: ge-0/0/0
state: presentEXPECTED RESULTS
netbox_cable with the given termination points should be created.
ACTUAL RESULTS
❯ ansible-playbook -vvv netbox.yml
ansible-playbook 2.10.2
config file = None
configured module search path = ['/Users/***/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/***/p/issue-ansible-netbox-20201014/.direnv/python-3.8.5/lib/python3.8/site-packages/ansible
executable location = /Users/***/p/issue-ansible-netbox-20201014/.direnv/python-3.8.5/bin/ansible-playbook
python version = 3.8.5 (default, Sep 23 2020, 11:29:00) [Clang 10.0.1 (clang-1001.0.46.4)]
No config file found; using defaults
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
ini declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
toml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
[ ... output of successful tasks omitted ...]
TASK [Create cable] ************************************************************
task path: /Users/***/p/issue-ansible-netbox-20201014/netbox.yml:102
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: ***
<127.0.0.1> EXEC /bin/sh -c 'echo ~*** && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/***/.ansible/tmp `"&& mkdir "` echo /Users/***/.ansible/tmp/ansible-tmp-1602732303.0875819-60851-254968331164883 `" && echo ansible-tmp-1602732303.0875819-60851-254968331164883="` echo /Users/***/.ansible/tmp/ansible-tmp-1602732303.0875819-60851-254968331164883 `" ) && sleep 0'
Using module file /Users/***/.ansible/collections/ansible_collections/netbox/netbox/plugins/modules/netbox_cable.py
<127.0.0.1> PUT /Users/***/.ansible/tmp/ansible-local-60644_5ku471b/tmplrkkelpo TO /Users/***/.ansible/tmp/ansible-tmp-1602732303.0875819-60851-254968331164883/AnsiballZ_netbox_cable.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/***/.ansible/tmp/ansible-tmp-1602732303.0875819-60851-254968331164883/ /Users/***/.ansible/tmp/ansible-tmp-1602732303.0875819-60851-254968331164883/AnsiballZ_netbox_cable.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/Users/***/p/issue-ansible-netbox-20201014/.direnv/python-3.8.5/bin/python /Users/***/.ansible/tmp/ansible-tmp-1602732303.0875819-60851-254968331164883/AnsiballZ_netbox_cable.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/***/.ansible/tmp/ansible-tmp-1602732303.0875819-60851-254968331164883/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/Users/***/.ansible/tmp/ansible-tmp-1602732303.0875819-60851-254968331164883/AnsiballZ_netbox_cable.py", line 102, in <module>
_ansiballz_main()
File "/Users/***/.ansible/tmp/ansible-tmp-1602732303.0875819-60851-254968331164883/AnsiballZ_netbox_cable.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/Users/***/.ansible/tmp/ansible-tmp-1602732303.0875819-60851-254968331164883/AnsiballZ_netbox_cable.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible_collections.netbox.netbox.plugins.modules.netbox_cable', init_globals=None, run_name='__main__', alter_sys=True)
File "/Users/***/.pyenv/versions/3.8.5/lib/python3.8/runpy.py", line 207, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/Users/***/.pyenv/versions/3.8.5/lib/python3.8/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/Users/***/.pyenv/versions/3.8.5/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/var/folders/3p/qb3ch1gx4l11t4gf4grl4fbh0000gn/T/ansible_netbox.netbox.netbox_cable_payload_mvthe_ih/ansible_netbox.netbox.netbox_cable_payload.zip/ansible_collections/netbox/netbox/plugins/modules/netbox_cable.py", line 367, in <module>
File "/var/folders/3p/qb3ch1gx4l11t4gf4grl4fbh0000gn/T/ansible_netbox.netbox.netbox_cable_payload_mvthe_ih/ansible_netbox.netbox.netbox_cable_payload.zip/ansible_collections/netbox/netbox/plugins/modules/netbox_cable.py", line 362, in main
File "/var/folders/3p/qb3ch1gx4l11t4gf4grl4fbh0000gn/T/ansible_netbox.netbox.netbox_cable_payload_mvthe_ih/ansible_netbox.netbox.netbox_cable_payload.zip/ansible_collections/netbox/netbox/plugins/module_utils/netbox_dcim.py", line 55, in __init__
File "/var/folders/3p/qb3ch1gx4l11t4gf4grl4fbh0000gn/T/ansible_netbox.netbox.netbox_cable_payload_mvthe_ih/ansible_netbox.netbox.netbox_cable_payload.zip/ansible_collections/netbox/netbox/plugins/module_utils/netbox_utils.py", line 465, in __init__
File "/var/folders/3p/qb3ch1gx4l11t4gf4grl4fbh0000gn/T/ansible_netbox.netbox.netbox_cable_payload_mvthe_ih/ansible_netbox.netbox.netbox_cable_payload.zip/ansible_collections/netbox/netbox/plugins/module_utils/netbox_utils.py", line 768, in _find_ids
KeyError: 'circuits.circuittermination'
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/Users/***/.ansible/tmp/ansible-tmp-1602732303.0875819-60851-254968331164883/AnsiballZ_netbox_cable.py\", line 102, in <module>\n _ansiballz_main()\n File \"/Users/***/.ansible/tmp/ansible-tmp-1602732303.0875819-60851-254968331164883/AnsiballZ_netbox_cable.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/Users/***/.ansible/tmp/ansible-tmp-1602732303.0875819-60851-254968331164883/AnsiballZ_netbox_cable.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.netbox.netbox.plugins.modules.netbox_cable', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/Users/***/.pyenv/versions/3.8.5/lib/python3.8/runpy.py\", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/Users/***/.pyenv/versions/3.8.5/lib/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/Users/***/.pyenv/versions/3.8.5/lib/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/var/folders/3p/qb3ch1gx4l11t4gf4grl4fbh0000gn/T/ansible_netbox.netbox.netbox_cable_payload_mvthe_ih/ansible_netbox.netbox.netbox_cable_payload.zip/ansible_collections/netbox/netbox/plugins/modules/netbox_cable.py\", line 367, in <module>\n File \"/var/folders/3p/qb3ch1gx4l11t4gf4grl4fbh0000gn/T/ansible_netbox.netbox.netbox_cable_payload_mvthe_ih/ansible_netbox.netbox.netbox_cable_payload.zip/ansible_collections/netbox/netbox/plugins/modules/netbox_cable.py\", line 362, in main\n File \"/var/folders/3p/qb3ch1gx4l11t4gf4grl4fbh0000gn/T/ansible_netbox.netbox.netbox_cable_payload_mvthe_ih/ansible_netbox.netbox.netbox_cable_payload.zip/ansible_collections/netbox/netbox/plugins/module_utils/netbox_dcim.py\", line 55, in __init__\n File \"/var/folders/3p/qb3ch1gx4l11t4gf4grl4fbh0000gn/T/ansible_netbox.netbox.netbox_cable_payload_mvthe_ih/ansible_netbox.netbox.netbox_cable_payload.zip/ansible_collections/netbox/netbox/plugins/module_utils/netbox_utils.py\", line 465, in __init__\n File \"/var/folders/3p/qb3ch1gx4l11t4gf4grl4fbh0000gn/T/ansible_netbox.netbox.netbox_cable_payload_mvthe_ih/ansible_netbox.netbox.netbox_cable_payload.zip/ansible_collections/netbox/netbox/plugins/module_utils/netbox_utils.py\", line 768, in _find_ids\nKeyError: 'circuits.circuittermination'\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
PLAY RECAP *********************************************************************
localhost : ok=10 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

