Unable to execute playbook via AWX Tower due to "No inventory was parsed, please check your configuration and options."

AWX Inventory Parsing Error - Malformed Python Script Issue

Environment

  • AWX Version: 17.1.0
  • Installation: Docker containers
  • Ansible Version: 2.9.18
  • OS: Red Hat Enterprise Linux

Problem Description

Important Context: Playbook execution works perfectly when run directly from the terminal/host level using ansible-playbook. However, when attempting to execute the exact same playbooks via the AWX GUI, I encounter persistent inventory parsing errors where AWX tries to parse a malformed Python script as inventory data instead of using my properly configured static inventory.

This issue has persisted for over 2 weeks despite extensive troubleshooting efforts.

Error Details

Primary Error:

[WARNING]: * Failed to parse /tmp/bwrap_xxx/awx_xxx/tmpxxxxxx with yaml plugin: 
We were unable to read either as JSON nor YAML, these are the errors we got from each:
JSON: Expecting value: line 1 column 1 (char 0) 
Syntax Error while loading YAML. did not find expected key 
The error appears to be in '/tmp/bwrap_xxx/awx_xxx/tmpxxxxxx': line 3, column 61, but may be elsewhere in the file depending on the exact syntax problem. 

The offending line appears to be: 
# -*- coding: utf-8 -*- print('{"all": {"hosts": [], "children": ["target_servers"]}, "target_servers": {"hosts": ["192.168.1.100", "192.168.1.101"]}, "_meta": {"hostvars": {"192.168.1.100": {"remote_tower_enabled": "true"}, "192.168.1.101": {"remote_tower_enabled": "true"}}}}') 
^ here

Additional Warnings:

  • Failed to parse with ini plugin: host range must be begin:end or begin:end:step
  • Failed to parse with script plugin: Inventory script had an execution error
  • Unable to parse as an inventory source
  • ERROR! No inventory was parsed, please check your configuration and options

Current Setup

Inventory Configuration:

  • Static inventory “XYZ Servers” with 2 hosts configured via GUI:
    • 192.168.1.100 (variables: remote_tower_enabled: true)
    • 192.168.1.101 (variables: remote_tower_enabled: true)
  • Sources tab is empty (no dynamic inventory sources)

Job Template:

  • Project: “XYZ Project” (Manual source control type)
  • Inventory: “XYZ Servers”
  • Simple ping playbook that works fine at host level

Original Playbook:

---
- name: Ping all targets
  hosts: target_servers
  gather_facts: false
  vars_files:
    - secrets.yml
  tasks:
    - name: Ping target machines
      ansible.builtin.ping:

Simplified Playbook (after troubleshooting):

---
- name: Ping all targets
  hosts: target_servers
  gather_facts: false
  tasks:
    - name: Ping target machines
      ansible.builtin.ping:

Note: The secrets.yml is an encrypted Ansible Vault file containing sensitive variables.

What I’ve Tried

  1. Verified inventory configuration - hosts are properly defined in AWX GUI
  2. Checked inventory sources - sources tab is completely empty
  3. Investigated vault file issues - original playbook used encrypted secrets.yml (Ansible Vault)
  4. Created vault credentials in AWX - added proper vault password credential to job template
  5. Tested without vault files - removed vars_files: - secrets.yml completely, same error persists
  6. Created completely simplified playbooks - basic ping with no variables or imports
  7. Created fresh inventories and job templates - same error occurs with new objects
  8. Restarted AWX containers - no change in behavior
  9. Verified project files - no problematic inventory scripts found in project directory
  10. Tested playbook at host level - works perfectly outside AWX with ansible-playbook

Key Observations

  • Terminal execution vs GUI execution: Identical playbooks work flawlessly when executed directly from the host terminal but fail consistently in AWX GUI
  • The malformed script appears to be generated by AWX internally, not from project files
  • Error persists even after removing Ansible Vault files - originally suspected vault decryption issues
  • Error occurs with both vault-enabled and completely simplified playbooks
  • Static inventory hosts are visible and properly configured in AWX GUI
  • Same error occurs across different job templates and inventories
  • The temp file paths suggest AWX is creating these files during job execution
  • Perfect host-level execution - ansible-playbook -i inventory ping.yml runs successfully outside AWX

Docker Container Setup

docker ps shows:
- awx_web (ansible/awx:17.1.0)
- awx_task (ansible/awx:17.1.0) 
- awx_redis (redis:6.0.9)
- awx_postgres (postgres:12)

Questions for Community

  1. What could cause AWX to generate this malformed Python script internally?
  2. Are there any AWX configuration settings that might trigger this behavior?
  3. Could this be related to database corruption or cached data?
  4. Has anyone encountered similar inventory parsing issues with AWX 17.1.0?

Request for Help

This issue has been persistent for over 2 weeks despite extensive troubleshooting attempts. The fact that identical playbooks work perfectly from the terminal but fail consistently in AWX GUI suggests there might be a deeper AWX configuration, containerization, or system-level issue.

Any insights, suggestions, or similar experiences would be greatly appreciated!

Tags: awx ansible inventory docker #Troubleshooting