Closed kiaz-github closed 2 months ago
I encountered this myself as well. I had upgraded my execution environment from before v3.18 release, believe we were using 3.17.0. Recompiled to use latest (3.19.1) release of netbox ansible modules. Worked fine, but this morning I upgraded by Netbox instance from 3.7.3 to 4.0.5. Started getting "Failed to establish connection to NetBox API", even on production playbooks that worked before upgrade. I snapshotted before upgraded Netbox, reverted to my 3.7.3 snapshot, re-ran playbooks that failed and they worked once again. REST calls from dev software worked fine, but in my nginx logs I am seeing 403 HTTP codes from my ansible host when playbooks are run.
UPDATED:
I think I found the behavior causing this. I ran the playbook against a mock server that would print out all incoming HTTP requests. What I saw was that there was an initial GET for hostname/api. Followed later by other calls for hostname/api/status and the like.
The first call for foo/api did not include a token. All subsequent API calls did have a token in header. I pulled Postman up and what I noticed was that if I turned off the Token in my header and did a GET against my 3.X host hostname/api it worked. Same against host upgraded to 4.x and it would give me a 403 error. Not sure where the breaking change comes in here. We could run the hostname/api call with the token the script already has and it should work. FWIW
The ticket I had opened about the /api 403 behavior was closed as duplicate. The ticket it was duplicate of was closed weeks ago basically saying 'This is the intended behavior, will update documentation to say so'.
Module will need to auth all API calls.
Encountering the same issue - none of my playbooks work after upgrading to 4.0.3. Does someone have a workaround that doesn't involve downgrading NetBox again?
Hi all,
I solved my issue as described here: https://github.com/netbox-community/netbox/issues/16414#issuecomment-2151805183
I've just released pynetbox
7.3.4, which should address this bug.
I've just released
pynetbox
7.3.4, which should address this bug.
Looks like its working for me now too. Thanks for your work!
Fixed with pynetbox 7.3.4.
Ansible NetBox Collection version
v3.18.0
Ansible version
NetBox version
v4.0.3
Python version
3.10
Steps to Reproduce
Expected Behavior
The connection to the NeBox API works and the Ansible Playbook is executed.
Observed Behavior
"Failed to establish connection to NetBox API"