Unable to discovery Ansible Tower with Cloud Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 08:42 AM
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)
- 2,595 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2019 10:09 AM
Hi Hardik,
Thanks for the reply, as I am late to see this. I have updated my script with the one you provided, however, I am still not able to obtain a successful discovery. The error that I receive is:
Failed to execute API - Failed with status code and message: 500: Failed with status code and message: 401: {"detail":"Authentication credentials were not provided."} (ad_hoc:ansible-tower-1.0-Discover; line 63)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2019 02:10 PM
Hello,
I'm currently facing similar error
java.lang.RuntimeException: Failed to execute API - Failed with status code and message: 500: TypeError: Cannot convert null to an object. (ad_hoc:ansible-tower-1.0-Discover; line 63).
Does anyone have any update to fix this issue? Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2020 08:57 AM
Updating an old post since this one came up when I was hitting similar issues. For anybody with this issue in 2020...
1) Make sure that the MID Server setting mid.cmp.ansible.api_version is changed from "v1" to "v2".
2) The attached AnsibleTowerAPIBase above is likely based on an older version. The current version (well in New York and Orlando) has support for Basic Authentication built in. Basic Authentication needs to be enabled in Ansible Tower (on the Settings > System page). I think Tower needs to be restarted for this to take affect.
I tweaked my version of AnsibleTowerAPIBase to support using an OAuth token. To do so I generated a token in Ansible Tower, stored that token in the Password for the Credentials record, and then updated the code block in the _getToken method to:
else if(versionIdentifier <= 0){
// note: remove or comment out the existing code here
return "Bearer " + this.towerPassword;
}