Ansible failed to parse inventory file as an inventory source

This was really irritating.

I was trying to run a very simple ansible playbook, in fact, just one template task, to generate a file. But when I tried running it, I kept getting:

[WARNING]: Unable to parse /home/kobi/inv_file as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hoses list is empty, only localhost is available. Note that the implicit localhost does not match 'all'.

This was really frustrating because I was specifying the inv_file with -i on my ansible-playbook invocation, and all the google results were just people whose /etc/ansible/ansible.cfg was pointing to some other file. Since I was specifying my inventory manually, it took a while to figure out what the problem was — in my own ansible.cfg, under [inventory] , I found enable_plugins = script. Now, I am not certain of this, but I believe that such a specific configuration will result in those plugins which are generally enabled by default, to be disabled. Commenting out enable_plugins solved my problem.

--

--

Kobi Rosenstein

Linux infrastructure guy. This blog chronicles my “gotcha” moments — Each post contains an answer I would have like to have found when trawling google.