This is a shorty but it is incredibly useful when you need to diagnose Ansible weirdness.

Note: I know this is obvious but when you have used Ansible and AWS extensively, you get used to just being a component to Ansible and you don’t even think about calling it directly.

We recently had a situation where all of our Ansible driven deploys were failing. And the reason for this wasn’t easy to diagnose because all of our deploys were wrapped up in fairly complex shell logic. What helped us sort it out was breaking the underlying Ansible execution pipeline apart and calling directly. is the open source bit that talks to an AWS environment and returns a massive data structure that represents the “inventory” of servers, volumes, network connections, etc.

Here’s the way to call directly

AWS_ACCESS_KEY_ID=some_access_key AWS_SECRET_ACCESS_KEY=some_secret_key /etc/ansible/inventory/

As long as your is executable (and it damn well should be), this will return the normal giant JSON hash of data that represents your AWS environment. And if it doesn’t return a giant JSON hash, well, then you know you have a problem.