I would start debugging from this line -
https://github.com/netbox-community/ansible_modules/blob/8ef1932f2a40d1d913429e939d8da0abcd927c9d/plugins/module_utils/netbox_utils.py#L695
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.
On Thu, Jul 21, 2022 at 8:35 PM maulik patel <[email protected]>
wrote:
> 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 ..!!
>
> On Thu, 21 Jul 2022 at 8:30 PM Heinz Meier <[email protected]>
> wrote:
>
>> Yes. But I don't remember how
>>
>> maulik patel <[email protected]> schrieb am Do., 21. Juli 2022,
>> 13:09:
>>
>>> did you get it resolved ?
>>>
>>> On Thursday, July 2, 2020 at 12:30:54 AM UTC+5:30 [email protected]
>>> wrote:
>>>
>>>> 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::
>>>> url: https://127.0.0.1/api/
>>>> 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?
>>>>
>>> --
>>>
>> 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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/64e1ca8a-d364-410c-ad16-2669ed7dc60bn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/64e1ca8a-d364-410c-ad16-2669ed7dc60bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAFFTi_Ktj%3DcooDwux%2BNs8Fg2B35Y4TShprU83ZB8B9gGK%3D22KQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAFFTi_Ktj%3DcooDwux%2BNs8Fg2B35Y4TShprU83ZB8B9gGK%3D22KQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAPxXP%2BXK9cXR7%3DuiJq2f-njWtAyc6wBzUqa%3DAChkQeWNK-6c_A%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAPxXP%2BXK9cXR7%3DuiJq2f-njWtAyc6wBzUqa%3DAChkQeWNK-6c_A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
Thanks,
Abhijeet Kasurde
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAFwWkHot7Gx5tAkowHNQastiCA5prdqmkwayx8B75Eus2kC7gw%40mail.gmail.com.