Dynamic inventory finds the instances, but every host is `UNREACHABLE`
IntermediateTroubleshootingCloud, AWX, Windows and Molecule
Answer
Likely causes → By default, the plugin names hosts by public DNS. Private-subnet instances have no public DNS, or the controller cannot route to it. Ansible then tries to connect to an address that does not work.
Diagnose → ansible-inventory -i prod.aws_ec2.yml --host <name> | jq '.ansible_host, .private_ip_address, .public_dns_name'
Fix →
hostnames:
- tag:Name
- private-ip-address
compose:
ansible_host: private_ip_address
Run from inside the VPC, or go through a bastion (ProxyJump) or SSM.
Prevent → Use readable names for hosts (tag:Name) and keep connection addresses in compose.
More on Cloud, AWX, Windows and Molecule
`Failed to import the required Python library (botocore and boto3) on web01's Python /usr/bin/python3.`Beginner`[WARNING]: * Failed to parse inventory/aws.yml with auto plugin: inventory source 'inventory/aws.yml' could not be verified by inventory plugin 'amazon.aws.aws_ec2'`IntermediateThe `aws_ec2` inventory parses without errors but returns zero hostsIntermediate`Failed to describe instances: An error occurred (UnauthorizedOperation) when calling the DescribeInstances operation` or `(ExpiredToken)`IntermediateUsing the SSM connection plugin fails with `SessionManagerPlugin is not found` or hangs on file transferAdvanced`winrm or requests is not installed: No module named 'winrm'`Beginner