Score:0

AWX can't find host during provisioning callback

cn flag

I have recently set up RHEL Satellite and I'm now integrating with our AWX/Ansible Tower implementation. The curl request I'm using is as follows:

/usr/bin/curl -k -s --data "host_config_key={REDACTED}" https://awx.fqdn.com/api/v2/job_templates/34/callback/

This appears to (correctly) kick off an inventory sync (and the host is in the Satellite inventory), yet the AWX server returns {"msg":"No matching host could be found!"}

The documentation I have found is sparse on this topic, but notes that the hostname or IP may be used to determine the host in inventory.

The hostname returned by hostnamectl is the FQDN of the host (which matches the hostname in inventory exactly), but I've also tried setting it to the short name with the same results.

I found an rDNS issue yesterday but sorted it out so now the IP resolves correctly to the inventory hostname as well.

How does AWX determine the hostname to use? Are there any logs I can refer to?

EDIT: I should also add I've tried a GET request with an admin username/password and the array of matching_hosts is empty.

curl http://admin:[email protected]/api/v2/job_templates/34/callback/
{"host_config_key":"{REDACTED}","matching_hosts":[]}
Score:0
cn flag

Okay I figured this out. I'm using a Kubernetes deployment, and AWX was not seeing the client's true IP as requests are being proxied through Nginx.

Looking at the webserver container logs got me on the right track as they showed the nginx ingress IP rather than the client device. The solution was as simple as setting HTTP_X_FORWARDED_FOR in my AWX spec and restarting the deployment.

I'll put some notes here as well in case it helps someone else...

  1. AWX does appear to resolve the host from IP based on inventory alone (rDNS is not required as I initially thought)
  2. The matching_hosts array returned by AWX only includes hosts matching the IP of the current request (probably obvious, but I thought for a moment it might return the full inventory)
  3. Only the inventory is updated/checked during this initial pass, and the hosts section configured in the playbook is irrelevant. Only after the inventory is updated and matches a host will the playbook be called. (again, probably obvious but it wasn't 100% clear to me)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.