Molecule passes locally but fails in GitHub Actions at `Gathering Facts` with `/bin/sh: 1: python3: not found`
AdvancedTroubleshootingCloud, AWX, Windows and Molecule
Answer
Likely causes → The CI scenario uses a bare official image (ubuntu:24.04, debian:12) with no Python. Locally, a cached test image with Python was used.
Fix → Use an image that has Python and systemd (pre_build_image: true), or bootstrap in prepare.yml before facts are gathered:
- hosts: all
gather_facts: false
tasks:
- ansible.builtin.raw: test -e /usr/bin/python3 || (apt-get update && apt-get install -y python3)
changed_when: false
Prevent → Pin test images by tag or digest in molecule.yml, and run CI and local tests with the same images.
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)`IntermediateDynamic inventory finds the instances, but every host is `UNREACHABLE`IntermediateUsing the SSM connection plugin fails with `SessionManagerPlugin is not found` or hangs on file transferAdvanced