SKipping no hosts matched

Hello,
i ran this

ansible-playbook setup.yml -i ‘10.22.212.184,’ and i got the error message as no hosts matched, the ip i gave should be entered somewhere else as inventory file as well?

No, that is enough to add to inventory, but it won't add it to
specific groups which your plays might be targeting (`hosts:`
keyword).

i dont get this, this is not working, how can i make it work? :frowning:

When you use -i you are pointing Ansible to a inventory file. In your case that inventory file is named as ‘10.22.212.184,’ - does a file with that name exist at all?

If I try to replicate your setup, pointing to an IP address with -i without a corresponding inventory file with that name, I not only get the ‘no hosts matched’ error I also get the following:

← Cut →

[WARNING]: Host file not found: 192.168.56.11
[WARNING]: provided hosts list is empty, only localhost is available

← Cut →

Do you also see the above when you run it in your end?

There are some info about how to create your inventory file(s) here: http://docs.ansible.com/ansible/latest/intro_inventory.html That could be worth having a look at in order to troubleshoot this further.

Cheers, Mike

Set hosts: all in your plays

i cannot run a playbook straightaway against a single host without having that in inventory?

You can run it with a single host like: “ansible-playbook -i <hostname/ip>, playbookname.yml”

But for it not to complain you must have the statement ‘hosts: all’ in your playbook.

Cheers, Mike

wow, good, its runnning but now throwing a weird error ""Failed to connect to the host via ssh: ssh: connect to host " Why does it take ssh why it is not using winrm? :frowning:

I believe that ssh is default for Ansible unless otherwise stated. Have you defined that it should use winrm as the connection method for this host anywhere?

nope, this IP has no entry anywhere:( i am kind of confused, usually group_vars folder has entry for group that we mention in hosts:web , but this time its all, how can i do this? should i have any entry in ansible.cfg

add `-c winrm ` to the command.

got it working, just added all.yml in group_Vars…wow…awesome…thanks buddy