Ansible ad-hoc command with direct host specified - no hosts matched

妖精的绣舞 提交于 2019-12-03 11:56:05

I provide this host's IP address directly in the command. In this very case, according to my understanding, the inventory file is irrelevant.

Wrong. You specify host pattern, which should match hosts in your inventory. Inventory is a must for Ansible.

There's an option to specify "inline" inventory. For your case:

ansible all -i '10.0.3.248,' -m ping -u ubuntu

in this example: host pattern is all, inventory is a list of a single host 10.0.3.248.
Note comma at the end – it is important, this way Ansible understand that it is inline inventory, and not path to file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!