# Unable to parse /runner/inventory/hosts as an inventory source

**URL:** <https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285>\
**Category:** Get Help\
**Tags:** vmware, fedora, playbook, awx, collections, galaxy-ng\
**Created:** [January 12, 2024, 6:02am UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285 "2024-01-12T06:02:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![marshit](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@marshit](https://forum.ansible.com/u/marshit)\
**Post date:** [January 12, 2024, 6:02am UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/1 "2024-01-12T06:02:49Z")

</div>

Let me make sure I get this all straight with detail. I’m so close to figuring this out, but I have hit a roadblock. I’m simply trying to automate any process at this point within VMware by way of AWX.

I have installed the following:

pip install pyvmomi  
ansible-galaxy collection install community.vmware

Running AWX 23.6.0

My “inventory” for hosts is sourced from GitHub, and that sync works fine, pointing to /(project root).

Within my “project root” directory on GitHub, I have the following files:

```auto
inventory.ini:

[vcsa]
10.0.0.3

[esxi]
10.0.0.0
10.0.0.1

```

```auto
ansible.cfg:

[inventory]
enable_plugins = community.vmware.vmware_vm_inventory

vmware_vm_inventory.vmware.yml:

plugin: community.vmware.vmware_vm_inventory
strict: False
hostname: 10.0.0.3
username: <removed username here>
validate_certs: False
with_tags: False
with_folders: True

```

Now, within AWX, my Inventory and Projects items sync just fine.

I’m running AWX on Fedora, but I wouldn’t think that would be a big concern. If I perform a Dynamic Inventory for VCSA, it works fine.

For the life of me, I can’t get any playbooks to run without the inventory file being parsed.

Here is the playbook:

```auto
---
- name: Add a distributed switch to vCenter datacenter
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Add distributed switch
      community.vmware.vmware_dvs_host:
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        validate_certs: no
        esxi_hostname: "{{ esxi_hostname }}"
        switch_name: "{{ switch_name }}"
        datacenter_name: "HOME-1"
        state: present

```

I feel like I’m 99% there on getting this to work. If not, I will just go back to using Python and PowerCLI, which I have no problem getting to work, but I really want to get AWX working.

---

<div class="post-metadata">

**Author:** ![chrismeyersfsu](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chrismeyersfsu/32/1016_2.png) [@chrismeyersfsu](https://forum.ansible.com/u/chrismeyersfsu)\
**Post date:** [January 12, 2024, 6:34pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/2 "2024-01-12T18:34:44Z")

</div>

@marshit can you screenshot or copy paste the error you are experiencing?

It’s not completely clear to me what you expect the behavior to be.

---

<div class="post-metadata">

**Author:** ![marshit](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@marshit](https://forum.ansible.com/u/marshit)\
**Post date:** [January 12, 2024, 6:56pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/3 "2024-01-12T18:56:51Z")

</div>

What I expect is the playbook to run against my vCenter host to create a distributed switch.

Here is the screenshot:

 ![Cannot_Parse_Error](https://us1.discourse-cdn.com/ansible/original/2X/e/ebdbf3bee81d8470ef5c8471d5155b531e943061.png)

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [January 12, 2024, 7:11pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/4 "2024-01-12T19:11:47Z")

</div>

From the [synopsys](https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_vm_inventory_inventory.html#synopsis):

> Uses any file which ends with vmware.yml, vmware.yaml, vmware\_vm\_inventory.yml, or vmware\_vm\_inventory.yaml as a YAML configuration file.

Your inventory isn’t named that way. I don’t know if that’s the issue, but that’s what jumps out at me.

EDIT: Looks like that’s it.

```python
    def verify_file(self, path):
        """
        Verify plugin configuration file and mark this plugin active
        Args:
            path: Path of configuration YAML file
        Returns: True if everything is correct, else False
        """
        valid = False
        if super(InventoryModule, self).verify_file(path):
            if path.endswith(('vmware.yaml', 'vmware.yml', 'vmware_vm_inventory.yaml', 'vmware_vm_inventory.yml')):
                valid = True

        return valid

```

---

<div class="post-metadata">

**Author:** ![marshit](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@marshit](https://forum.ansible.com/u/marshit)\
**Post date:** [January 12, 2024, 7:16pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/5 "2024-01-12T19:16:19Z")

</div>

@utoddl Hello Todd, so just to clarify. So I may have things backwards, is what you are saying.

My “vmware\_vm\_inventory.vmware.yml” should look like this:

```auto
[vcsa]
10.0.0.3

[esxi]
10.0.0.0
10.0.0.1

```

I can create another file maybe called vars.yml, and add the following:

```auto
plugin: community.vmware.vmware_vm_inventory
strict: False
hostname: 10.0.0.3
username:
validate_certs: False
with_tags: False
with_folders: True

```

Then based upon that I don’t need the “inventory.ini” file at all correct?

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [January 12, 2024, 7:38pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/6 "2024-01-12T19:38:30Z")

</div>

All I can say for certain is we’re both confused.

The first bit you showed above looks like a .INI style inventory, not valid YAML, so I’m pretty sure that’s wrong, at least it’s not the .yml file the plugin wants.

The second bit, starting with `plugin:`, looks like [Parameters](https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_vm_inventory_inventory.html#parameters), which that page says is what’s supposed to be in `vmware_vm_inventory.yml` (or one of those similar names). You configure the location of your inventory file (which is really the config file for the vmware\_vm\_inventory plugin) in your ansible.cfg, probably right after `enable_plugins = …`.

You can have multiple inventory sources, so the `inventory.ini` you started with should be fine, but you need to configure them both in your `[inventory]` section, or with `-i` on the command line (multiple times if needed) or through job templates in AWX.

---

<div class="post-metadata">

**Author:** ![marshit](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@marshit](https://forum.ansible.com/u/marshit)\
**Post date:** [January 12, 2024, 7:55pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/7 "2024-01-12T19:55:52Z")

</div>

I changed my inventory file back to “inventory.yml”.

```auto
all:
  children:
    vcsa:
      hosts:
        vcsa.mars12.local:
          ansible_host: 10.0.0.3
    esxi:
      hosts:
        10.0.0.1:
        10.0.0.2:
    vms:
      hosts:
        10.0.0.4:
        10.0.0.5:
        # ... and so on for each host in the 10.0.0.* range

```

Then I left me “vmware\_vm\_inventory.vmware.yml” as is:

```auto
plugin: community.vmware.vmware_vm_inventory
strict: False
hostname: 10.0.0.3
username:
validate_certs: False
with_tags: False
with_folders: True

```

Within AWX my Inventories item syncs fine with Github which is what I expected.

The problem still is the same when I then go and run a Template job to create a distributed switch.

Something still is causing AWX to not be able to parse the inventory file located on Github - even though my inventory sync within AWX works fine.

[WARNING]: Unable to parse /runner/inventory/hosts as an inventory source  
ERROR! No inventory was parsed, please check your configuration and options.

My “ansible.cfg” file still looks the same as before.

```auto
ansible.cfg:

[inventory]
enable_plugins = community.vmware.vmware_vm_inventory

```

Hope that explains a little better where I’m stuck. I feel like it’s something small I need to change, but heck if I know at this point. I have tried many things thus far.

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [January 12, 2024, 8:14pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/8 "2024-01-12T20:14:38Z")

</div>

Your `[inventory]` section still doesn’t point to an inventory.

```auto
[inventory]
enable_plugins = community.vmware.vmware_vm_inventory
inventory = path/to/vmware_vm_inventory.vmware.yml

```

Ironically, that ansible [configuration page](https://docs.ansible.com/ansible/latest/reference_appendices/config.html) shows an “`inventory =`” example in the first `Note:` on that page, but it never defines “`inventory`” as a valid keyword! I’m not sure how you would set it for multiple paths, but I suspect you can use a comma delimited list. That would let you include your .ini file and your vmware.yml both.

---

<div class="post-metadata">

**Author:** ![marshit](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@marshit](https://forum.ansible.com/u/marshit)\
**Post date:** [January 12, 2024, 8:22pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/10 "2024-01-12T20:22:25Z")

</div>

Let me add that line and see if it works.

Is that what it should say verbatim, “path/to/” since all files are within the root of the github repository?

---

<div class="post-metadata">

**Author:** ![marshit](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@marshit](https://forum.ansible.com/u/marshit)\
**Post date:** [January 12, 2024, 8:27pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/11 "2024-01-12T20:27:38Z")

</div>

Ironically, the Inventory item in AWX looks like it’s working and says its successfully pulled from Github. But when I look at the logs, it still says it can’t parse anything.

 ![2024-01-12_12-11-01](https://us1.discourse-cdn.com/ansible/original/2X/8/8f967cdd46aadb6333d269d3d93d0ca1b7ce8c2d.png)

---

<div class="post-metadata">

**Author:** ![marshit](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@marshit](https://forum.ansible.com/u/marshit)\
**Post date:** [January 12, 2024, 8:28pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/12 "2024-01-12T20:28:12Z")

</div>

![2024-01-12_12-10-37](https://us1.discourse-cdn.com/ansible/original/2X/8/8427f130e2ee44bfdb9c5571aadf2e56f32f26ba.png)

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [January 12, 2024, 8:45pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/13 "2024-01-12T20:45:33Z")

</div>

I fear we’re mixing things up. If you’re running a playbook from the CLI with `ansible-playbook`, then your “inventory sources” (possibly multiple files) are combined into an “inventory” — a logical level we mostly ignore because in the simple case inventories and inventory sources map 1:1.

In AWX, you define an _inventory_ as a separate “thing”, with one or more _inventory sources_. Some of those _inventory sources_ may be files pulled in from _projects_, or they can be scripts, or blobs of config like for your vmware case.

Then (still in AWX) you define a _project_ (from gitlab, github, or other places). Within that _project_ you define a _job template_. The _job template_ gets specific about, among other things, what _inventory_ it’s supposed to use.

Now here’s where it all gets guessworthy! AWX spins up a separate _execution environment_ for each job. That _ee_ gets customized before it starts running. One of the things that happens is running `ansible-galaxy` to satisfy any `./roles/requirement.yml` and `./collections/requirements.yml` that aren’t already satisfied. The other major bit is to populate `/runner/project/inventory.yml` with whatever your _job template_ has defined as the _inventory_ it’s supposed to use.

!!! At least, that (↑) is what my mental model of AWX job setup looks like. It may even be somewhat accurate. !!!

So until you get your AWX _inventory_ defined with its _inventory sources_, and associate that inventory with a _Job emplate_, it doesn’t matter what files you have in your SCM project (the Source Controlled/Managed(??) github thingy). It won’t affect what end up in the _ee_’s `/runner/project/inventory.yml`. That’s built from all those other bits I just listed.

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [January 12, 2024, 8:55pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/14 "2024-01-12T20:55:22Z")

</div>

Well, looks like I’m wrong. (Not the first time. Today even.)

`/runner/project` seems to be the root of your SCM project, and it took your top level `ansible.cfg` as one would hope.

So maybe you don’t have to define a separate inventory and inventory sources if they all come from the same project.

Live and learn. Thanks for showing me that.

In my experience, we started out with what I’d call a “fully articulated” AWX _organization_ – i.e. separate inventories for groups of loosely related groups of SCM projects. I’ve never seen one where everything is rolled into one like that. Interesting.

---

<div class="post-metadata">

**Author:** ![marshit](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@marshit](https://forum.ansible.com/u/marshit)\
**Post date:** [January 12, 2024, 9:04pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/16 "2024-01-12T21:04:57Z")

</div>

Well, thanks again for the feedback. It would seem it’s a simple resolution, but darn it, I just can’t figure out what direction to go at this point. I’m starting to feel like I will forget about Ansible and go back to the good old PowerCLI scripts I know work.

I think,: why use Ansible playbooks even on a controller node if I can just use PowerCLI? But I’m pushing myself to do this and learn with AWX.

But since most people, i.e. companies, love AWX and use VMware, I would like to get this to work. You may have something with that execution environment statement, hmmm…

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [January 12, 2024, 9:08pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/17 "2024-01-12T21:08:34Z")

</div>

Okay. I think I understand a lot more about where you are now, so maybe we can make better guesses. 🙂

Here’s what I’d try:

- Lose the `ansible.cfg` in the top level of your SCM project. I don’t think it’s contributing anything.
- Set your inventory in your job template to that “`VMware (Git)`” inventory you showed in the screenshot above.
- Launch the job and see if you get past the inventory issue. I think it should.

---

<div class="post-metadata">

**Author:** ![marshit](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@marshit](https://forum.ansible.com/u/marshit)\
**Post date:** [January 12, 2024, 9:29pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/18 "2024-01-12T21:29:19Z")

</div>

Hmmm, now we look to be moving along. Now it seems I need to lean up my playbook. But that’s the easy part…

😀

PLAY [Add a distributed switch to vCenter datacenter] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
TASK [Add distributed switch] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [localhost]: FAILED! =\> {“changed”: false, “msg”: “Unsupported parameters for (community.vmware.vmware\_dvs\_host) module: datacenter\_name. Supported parameters include: esxi\_hostname, hostname, lag\_uplinks, password, port, proxy\_host, proxy\_port, state, switch\_name, username, validate\_certs, vendor\_specific\_config, vmnics (admin, pass, pwd, user).”}  
PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

---

<div class="post-metadata">

**Author:** ![marshit](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@marshit](https://forum.ansible.com/u/marshit)\
**Post date:** [January 13, 2024, 10:37pm UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/19 "2024-01-13T22:37:42Z")

</div>

@utoddl Funny, now I get back to the same problem as before, where new playbooks don’t show up all the time in AWX. It’s not a problem I run into all the time, but occasionally it happens.

I would say your last response of removing the “ansible.cfg” file solved my problem. Now I have another problem with new files not showing up in AWX. I will get with that in another forum.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [January 14, 2024, 2:40am UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/20 "2024-01-14T02:40:06Z")

</div>

Glad it worked out. I learned a bit, too.

As for new playbooks not showing up, there are several ways to address that.

You can always go to the relevant AWX project page and click on the “sync project” icon in the “Actions” column. Check the “revision” column first, though, to see if it’s really necessary.

Another thing to consider is to check the box labeled “Update Revision on Launch” in your AWX project configuration. That will cause AWX to ensure it has fetched the latest content you’ve pushed to your SCM (git) before every launch of a job from one of that project’s templates. If you make way more updates than you run jobs, this might make sense. But if you run jobs much more frequently than you update your repo, maybe not. This won’t solve the problem on brand new playbooks not being selectable in a job template edit or survey – you’ll need to cause an SCM update manually for that – but it will address the “missing updates to content” problem.

We got tired of the whole problem and solved it another way. Our gitlab webhooks fire off a job which uses the AWX api and git to go through all our AWX projects. If one them either references the project directly, or if the project they do reference has a `requirements.yml` that references the updated repo, then that job will cause AWX to run an SCM update for that AWX project. That works remarkably well. Since we started doing that, we haven’t had to bother thinking about the problem. I remember how frustrating it was though, to make urgent changes, commit, and run a job in a hurry only to find that AWX hadn’t gotten the memo about the change. Glad those days are behind us.

---

<div class="post-metadata">

**Author:** ![marshit](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@marshit](https://forum.ansible.com/u/marshit)\
**Post date:** [January 14, 2024, 2:58am UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/21 "2024-01-14T02:58:22Z")

</div>

Yes, I always sync over and over again. The Update Revision I always have checked as a rule of thumb, I always check the update revision.

Now, in your last paragraph using the API this looks like what you mean correct - [22. Working with Webhooks — Ansible Tower User Guide v3.8.6](https://docs.ansible.com/ansible-tower/latest/html/userguide/webhooks.html)

If so, I can set that up.

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [January 14, 2024, 3:57am UTC](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285/22 "2024-01-14T03:57:40Z")

</div>

That’s very interesting; I’d never seen webhook credentials in AWX. Thanks for pointing that out.

We actually have our gitlab webhooks triggering Jenkins jobs (bash scripts) which do the AWX api work with `curl` and `jq`. They also run `ansible-lint`, and do a few other tricks, although not as many lately since `ansible-lint` has become so capable.

We’re looking at reducing our Jenkins footprint, though, and at doing more with gitlab runners. There are lots of ways to approach these problems now. Interesting times.

[Next page](https://forum.ansible.com/t/unable-to-parse-runner-inventory-hosts-as-an-inventory-source/3285.md?page=2)
