Open LoneSnowMonkey opened 5 months ago
To add to my earlier comment, I noticed module status in my 3.x installation, just not as 'up front' as it is in 4.x. The module documentation should be updated to say its a required field. Original, main issue of the module not working remains.
Here to report the same issue. I have all my module bays listed the same for easy automation.
But found out that the module plugin searches all module bays before checking which device.
So messing around with netbox's API I figured a way to get netbox to use a device specific module bay.
Not sure if this will work in the ansible galaxy collection
module_bay:
name: network card bay
device__name: foo-device
Ansible NetBox Collection version
v3.19.1
Ansible version
NetBox version
v3.7.3
Python version
3.10
Steps to Reproduce
I hope this is not a misunderstanding. In the past I've wanted to use netbox ansible modules to 'insert' a module into a module bay on a device. And while we could create a module_bay and a module_type, there wasn't such functionality. I did it using the URI module, but it of course required some additional logic and was not idempotent without further steps. I perused updates and see the new (to me)
netbox_module
.I spin up a playbook to test this as I am doing more of this sort of work this week. I've been modeling my Dell servers with a module bay called
network card bay
. This allows me to have the same model of server but to account for the fact that one might have been ordered with an installed 4 port Gb integrated NIC, whilst another might have pair of 10Gb SFP+ ports and a pair of gigabit. I poll the host during discovery, add the correct module, which then populates the appropriate network interfaces and such. Example playbook sanitized of details:Expected Behavior
I expected to see a Changed outcome to my playbook results and foo-device updated in network to now have a 4-port gigabit integrated network card, along with the new network interfaces.
Observed Behavior
My original problem was that I got
state is present but all of the following are missing: status
. I found this odd as I needed to have statepresent
in my playbook to indicate whether or not the module should be in the given module bay. Status was not listed as a required field so I left it out originally. In Netbox 3.X there is no status to a module. I put the status as active and re-ran the playbook. Now I get the errorMore than one result returned for module_bay
. This took me a bit to understand as I interpreted it to mean it searched all of the modules bays in foo-device and it found multiple with the namenetwork card bay
. That wasn't the case, of course. It wasn't until later that I realized looking through my nginx logs that theres a search for device with namefoo-device
and then a search for all module_bays with the namenetwork card bay
.I find this odd because, at least this is how I do it, I add module bays to device templates. I have one for iDRAC, a network card bay for the integrated NIC ordered for the machine. PCI slots. PSU slots. But they all have the same names in every device of that device type. Its
network card bay
nothostname's network card bay
.But that appears to be the source of the error, it's returning hundreds of results because I use that same module bay naming on every Dell server, regardless of model. But I've given it the host I am using.
I am unable to test against a Netbox 4.x server because of a different problem I am having. There I get
Failed to establish connection to NetBox API
when I talk to my 4.x dev server. Not sure why, the same token works from Postman. Added my $.02 to another open issue about this.