When i run the below code, i am not able to connect to the remote machine. When i check with tcpdump, no connection request is sent, it seems somehow no connection details are read from inventory files.
This is the error i saw when i install the ansible 2.0.0.1
raise AnsibleError(“no host vars as host is not in inventory: %s” % hostname)
ansible.errors.AnsibleError: ERROR! no host vars as host is not in inventory: 10.35.75.247
I realized that i haven’t set the ansible.cfg file path. My cli app is at another path and although i set the inventory variable there, nothing changed. Still not able to connect to the remote host. It is somehow not able to connect, not able to understand the user and password vars defined at the inventory.
It seems that the problem is definetly about reading the inventory. at the /Users/oyarimtepe/Dev/vmware/command-center/cc-cli/venv/lib/python2.7/site-packages/ansible/inventory/init.py
def get_host(self, hostname):
if hostname not in self._hosts_cache:
self._hosts_cache[hostname] = self._get_host(hostname)
**..**
**hosts_cache is empty.**
Thats why it is throwing exception. Seems i am doing something wrong about defining an Inventory as host.
Here is my hosts file /Users/oyarimtepe/Dev/vmware/command-center/register/hosts