如何在没有主机文件的情况下运行 Ansible [英] How to run Ansible without hosts file
本文介绍了如何在没有主机文件的情况下运行 Ansible的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在没有主机文件的情况下运行 Ansible?
How to run Ansible without hosts file?
就像:
$ ansible --"Some Options" IP -a 'uptime'
推荐答案
你可以这样做:
ansible all -i "<hostname-or-ip>," -a 'uptime'
注意 IP 地址末尾的 ,
,否则将被视为主机清单文件名.
Note the ,
at the end of the IP address, or it will be considered a hosts inventory filename.
这里有一个例子供参考:
Here is an example for reference:
ansible all -i "192.168.33.100," -a 'uptime'
192.168.33.100 | SUCCESS | rc=0 >>
12:05:10 up 10 min, 1 user, load average: 0.46, 0.23, 0.08
这篇关于如何在没有主机文件的情况下运行 Ansible的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文