netbox_interface module: Failed to establish connection to Netbox API"

400 views
Skip to first unread message

heinz6...@gmail.com

unread,
Jul 1, 2020, 3:00:54 PM7/1/20
to Ansible Project
Hi,

I am quite desparate already. I want to use the netbox_interface module in ansible, but it fails. To check it, I use the uri module:

- name: URI
  uri::
    method: GET
    header:
      Accept: application/json
      Authorization: Token XXXX
    validate_certs: false

This works without a problem.

Now the play

- name: netbox interface
  netbox_interface:
    netbox_url: https://127.0.0.1/
    netbox_token: XXXX
    data:
      device: switch01
      name: GigabitEthernet1
    state: present
    validate_certs: false

Results in the error: "Failed to establish connection to Netbox API"

pynetbox is installed and works.

Ideas?

maulik patel

unread,
Jul 21, 2022, 7:09:41 AM7/21/22
to Ansible Project
did you get it resolved ?

Heinz Meier

unread,
Jul 21, 2022, 11:00:49 AM7/21/22
to ansible...@googlegroups.com
Yes. But I don't remember how

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/64e1ca8a-d364-410c-ad16-2669ed7dc60bn%40googlegroups.com.

maulik patel

unread,
Jul 21, 2022, 11:05:32 AM7/21/22
to ansible...@googlegroups.com
If you can scratch your head little bit then I’ll be appreciated.. I’ve wasted couple of hours for these but no luck and im out of ideas…

Thank you ..!!

You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/B2wWVN8q4LQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAFFTi_Ktj%3DcooDwux%2BNs8Fg2B35Y4TShprU83ZB8B9gGK%3D22KQ%40mail.gmail.com.

Abhijeet Kasurde

unread,
Jul 21, 2022, 12:31:36 PM7/21/22
to ansible...@googlegroups.com
I would start debugging from this line -

replacing -

```
except Exception:
    self.module.fail_json(msg="Failed to establish connection to NetBox API")
```

with

```
except Exception as e:
    self.module.fail_json(msg="Failed to establish connection to NetBox API %s" % str(e))
```

This will atleast give a correct error and then onwards we can debug more.



--
Thanks,
Abhijeet Kasurde
Reply all
Reply to author
Forward
0 new messages