WARNING: The provided hosts list is empty only the localhost is available and note that the implicit localhost does not match all

In this article, we will discuss the fix to ‘WARNING: The provided hosts list is empty only the localhost is available and note that the implicit localhost does not match all”. It is worth pointing out that. When no external hosts are specified, Ansible defaults to using localhost. This is the local machine from which you are running Ansible. Please see “How to extend System Drive Partition on Windows“, and How to Disable Open File Security Warnings on Windows.
Also, see MySQL Workbench could not connect to MySQL server, how to Run MBR and GPT conversion with the best GPT converter, and how to fix “Error importing OVA file to AWS: Client error saved empty is empty“.
Why was the error “WARNING: The provided hosts list is empty only the localhost is available and note that the implicit localhost does not match all” prompted?
This error is because the section named “inventory” in the ansible.cfg file is commented out. The steps below are ways to resolve the issue.
By this, i mean when you run an Ansible playbook or command but haven’t specified any target hosts to run tasks against.
Solution
Access the following path in order to modify the ansible.cfg file as shown below C:\cygwin64\etc\ansible
Empty Hosts List Warning
Next, open the file with any of your favourite text editor. I will be using notepad++
- Uncomment the “inventory” out and
- Save the file (Do not forget to save 🙂 )
You can also use VIM as shown below. When you are done, ensure you save and quit with the following command as shown in the screenshot below.
Note: The host is present in the host file as well.
I hope you found this blog post on on the fix ‘WARNING: The provided hosts list is empty only the localhost is available and note that the implicit localhost does not match all” helpful. Please let me know in the comment session if you have any questions.



