Ansible issuing warning about localhost


I am running the following ansible playbook

Which yields the following warning:

[WARNING]: No inventory was parsed, only implicit localhost is available

[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’

Given that I am explicitly stating that it will be run against host: localhost, why is it complaining about no inventory being parsed and that the “provided host list is empty”?

How to remove these warnings? (without just suppressing them if possible)


This is just a warning telling you that you did not provide any inventory file (with -i), that the default one (usually /etc/ansible/hosts) could not be found and therefore your inventory is empty, only containing the implicit localhost.

hosts: localhost is the target for your play. It can be a host or a group (or a more complicated pattern). The targeted hosts must exist in the inventory to be managed. localhost always exists as the implicit local machine.


If your default inventory will stay empty and you basically only run playbooks targeted to localhost, you can suppress this warning by setting a config option in your environment or in ansible cfg

Leave a Reply