Ansible playbook运行ad-hoc命令

有人可以请帮助,我正在尝试为我们的VMWare虚拟主机创build一个Ansible的手册,但剧本将无法正常工作。 如果我自己运行相同的命令,它会成功。

单一的命令是有效的

ansible vhosts -vvv -k -m shell -a "vmkfstools -Ph -v 1 /vmfs/volumes/VMFS_01 | grep Mode" 

剧本

 ---
 - 主机:虚拟主机
   remote_user:root

  任务:
     - 名称:获取VMFS 01
       shell:vmkfstools -Ph -v 1 / vmfs / volumes / VMFS_01 |  grep模式

Playbook错误

致命的:[10.10.10.3]:失败!  => {“msg”:“/ bin / sh:sudo:找不到
 OpenSSH_6.6.1,OpenSSL 1.0.1e-fips 2013年2月11日
 debug1:读取configuration数据/ etc / ssh / ssh_config
 debug1:/ etc / ssh / ssh_config第56行:应用选项*
 debug1:自动多路复用器:尝试现有的主控器
 debug2:fd 3设置O_NONBLOCK
 debug2:mux_client_hello_exchange:主版本4
 debug3:mux_client_forwards:请求转发:0本地,0远程
 debug3:mux_client_request_session:进入
 debug3:mux_client_request_alive:进入
 debug3:mux_client_request_alive:done pid = 1810
 debug3:mux_client_request_session:发送会话请求
 debug1:mux_client_request_session:主会话ID:2
 debug3:mux_client_read_packet:读取头失败:损坏的pipe道
 debug2:从主设备127收到退出状态
共享连接到10.10.10.3closures。
 “,”failed“:true,”changed“:false,”parsed“:false,”invocation“:{”module_name“:”setup“,”module_args“:{}}}

安全2.0.0

事实上,我已经尝试了剧本中的一些基本模块,他们似乎都给出了同样的错误。

我设法在Google Group for Ansible上获得了成功的答案。

决议是明确地对“sudo”说“不”,并closures收集的事实。

 --- 
 - 主机:虚拟主机 
   gather_facts:false 
   sudo:不 
   remote_user:root 

感谢用户Brian Coca的https://groups.google.com/forum/#!topic/ansible-project/7KybtGyckHk