Unable to discovery Ansible Tower with Cloud Management

Brady Himmelric
Kilo Contributor

I am trying to connect my developer instance of London to my Ansible Tower instance. I am unable to get discovery working after configuring the URL.

 

Failed to execute API - Failed with status code and message: 500: Failed with status code and message: 401: {"detail":"Authentication credentials were not provided. To establish a login session, visit /api/login/."} (ad_hoc:ansible-tower-1.0-Discover; line 63)

7 REPLIES 7

Dontrell Harris
Kilo Contributor

I am receiving the same issue. How were you able to find the error message above?

Brady Himmelric
Kilo Contributor

 I found it in the Cloud Orchestration Trail. I am still having the issue so of if you were able to resolve please let me know. 

This is a known issues PRB1307724, ansible has changed the authentication mechanism again.

When running Ansible discovery to Ansible Tower 3.3, below error is received in Cloud API Trail:
Ansible Tower Credentials are Invalid !!!!!

This error is thrown by mid server script include:
AnsibleTowerAPIBase

the actual response from ansible is:
 {"detail":"Authentication credentials were not provided. To establish a login session, visit /api/login/."}

This is because even the token is provided (Token   AAAAAAAAaAAAAAAAAAAAAAAAAAAAAA), however Token based authentication is no longer supported in latest Ansible Tower API 3.3.
and "Authentication credentials were not provided" is the error when credential doesn't work.

OAuth 2 is used instead in 3.3
https://docs.ansible.com/ansible-tower/3.3.0/html/administration/oauth2_token_auth.html

I tried to do this via 3rd party REST testing tool Insomnia and confirmed this.
==

However please note basic authentication is still supported.
tried to pass header:  Authorization:Basic AAAAAAAAaAAAAAAAAAAA    this works.

Hardik Benani
Mega Sage
Mega Sage

Not sure if you managed to resolve this but it's a known issues PRB1307724, ansible has changed the authentication mechanism again. 

When running Ansible discovery to Ansible Tower 3.3, below error is received in Cloud API Trail:
Ansible Tower Credentials are Invalid !!!!!

This error is thrown by mid server script include:
AnsibleTowerAPIBase

the actual response from ansible is:
 {"detail":"Authentication credentials were not provided. To establish a login session, visit /api/login/."}

This is because even the token is provided (Token   AAAAAAAAaAAAAAAAAAAAAAAAAAAAAA), however Token based authentication is no longer supported in latest Ansible Tower API 3.3.
and "Authentication credentials were not provided" is the error when credential doesn't work.

OAuth 2 is used instead in 3.3
https://docs.ansible.com/ansible-tower/3.3.0/html/administration/oauth2_token_auth.html

I tried to do this via 3rd party REST testing tool Insomnia and confirmed this.
==

However please note basic authentication is still supported.
tried to pass header:  Authorization:Basic AAAAAAAAaAAAAAAAAAAA    this works.

 

Please try replacing the "AnsibleTowerAPIBase" MidServer Script include with the one attached here.

This is just a temporary workaround until ServiceNow provides a full fix, so make sure to revert when ServiceNow patches this.

PS: If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list."