ansible_modules
ansible_modules copied to clipboard
[Bug]: Front & rear port type lists too restrictive
Ansible NetBox Collection version
v3.20.0
Ansible version
ansible [core 2.18.3]
config file = /usr/local/lib/python3.13/site-packages/ansible_collections/netbox/netbox/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.13/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.13.2 (main, Feb 14 2025, 19:28:41) [GCC 14.2.0] (/usr/local/bin/python3.13)
jinja version = 3.1.5
libyaml = True
N.B. I set the Python version below to the highest it would go. I’m using 3.13, as you can see here.
NetBox version
v4.2.3
Python version
3.11
Steps to Reproduce
Try to create a front port of type usb-b:
- name: Create front port template within NetBox with only required information
netbox.netbox.netbox_front_port_template:
netbox_url: http://netbox.local
netbox_token: thisIsMyToken
data:
name: Test Front Port Template
device_type: Test Device Type
type: usb-b
rear_port_template: Test Rear Port Template
state: present
Expected Behavior
A new front port template should have been created.
Observed Behavior
An error was produced because both the front and rear port template modules allow very few options:
fatal: [localhost]: FAILED! => {"changed": false, "msg": "value of type must be one of: 8p8c, 110-punch, bnc, mrj21, fc, lc, lc-apc, lsh, lsh-apc, mpo, mtrj, sc, sc-apc, st, got: usb-b found in data"}
The list for v4.2.3 is in netbox-community/netbox:
https://github.com/netbox-community/netbox/blob/v4.2.3/netbox/dcim/choices.py#L1322