我搭建完虚拟环境(python 3.6和ansible stable-2.5),使用ansible-playbook --version时报错:
(.py3-a2.5-env) [deploy@ansible1 test_playbooks]$ ansible-playbook --version
Usage: ansible [options]
Define and run a single task ‘playbook’ against a set of hosts
Options:
-a MODULE_ARGS, --args=MODULE_ARGS
module arguments
…
Some modules do not make sense in Ad-Hoc (include, meta, etc)
ERROR! Missing target hosts
但使用ansible --version查看版本时,没有问题,显示如下:
(.py3-a2.5-env) [deploy@ansible1 test_playbooks]$ ansible --version
ansible 2.5.15 (stable-2.5 4f5084d9d2) last updated 2020/01/06 02:20:19 (GMT -400)
config file = None
configured module search path = [’/home/deploy/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /home/deploy/.py3-a2.5-env/ansible/lib/ansible
executable location = /home/deploy/.py3-a2.5-env/ansible/bin/ansible
python version = 3.6.5 (default, Jan 3 2020, 04:12:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]