Categories
ansible

AWX: ERROR! No inventory was parsed, please check your configuration and options.

Ensure that your playbook sets hosts: all as awx manages your host definition

As per AWX: Troubleshooting no inventory parsed

Well that didn’t work still got the same issue.

I found 4 relevant issues on github on the ERROR! No inventory was parsed, please check your configuration and options. issue:

Although there is no clarity there.

I then found this red hat article (behind a login wall) that tells you that you need to set the inventory plugin as an environment variable:

Solution

Update 2022: AWX no longer uses custom virtualenvs – it uses execution environments instead. So this post is probably not relevant.

It looks like this has to do with the custom venv.

I did not follow the documentation properly and the venv needs a few base dependencies that i did not install – namely psutils and ANSIBLE – Oops.

Anyway actviate the virtualenv and run:

pip install psutil
pip install -U "ansible == 2.9.5"

Ensure it has the correct permissions

sudo chmod 0755 /opt/awx_venvs/

After doing that running my playbook I still got an error:

No such file or directory: b'/opt/awx_venvs/provisioning/bin/ansible-playbook'

So I looked at the awx custom venv docs.

I followed the steps but received the same error. The virtualenv setup on the host was not correctly setup within the container.

So I needed to look at the Container based custom venv documentation

Wait scratch that it looks too tough

Custom VirtualEnv as Vars

I looked at Updating venv in additional vars, according to ryanpetrollo on this github issue.

So I added my venv_vars.yaml:

And ran the isntall again but the venvs were not created

So I stopped and removed the containers:

sudo docker stop awx_task awx_web awx_memcached awx_redis awx_postgres

and removed them:

sudo docker rm awx_task awx_web awx_memcached awx_redis awx_postgres

then ran:

ansible-playbook -i inventory install.yml --extra-vars "@venv_vars.yaml"

Still the venv was not created.

Looking through the code you need to be deploying the kubernetes way version for this to work.

So I used kubernetes and it worked (it’s also better this way as requirements are in code)

I had to add an extra variable to venv_vars.yml;

---

custom_venvs_path: "/opt/awx_venvs"

custom_venvs:
  - name: provisioning
    python: python3
    python_ansible_version: 2.9.5
    python_modules:
      - jmespath
      - netaddr
      - pyvcloud

Sources