lovi
lovi

Reputation: 105

ansible execute a single module on a single host

I would like to do something like this :

ansible -i MYHOST, windows -m win_ping

I have MYHOST that is in the inventory windows but I get this answer:

[WARNING]: No hosts matched, nothing to do

How can I select a specific host?

Upvotes: 1

Views: 5013

Answers (1)

techraf
techraf

Reputation: 68609

You've got your parameters and their values in wrong order. It should be:

ansible MYHOST -i windows -m win_ping

The value of -i argument points to the inventory file, host pattern should be given directly.

You also don't need a comma, it was an old hack for defining the target without a need for inventory file.

Upvotes: 1

Related Questions