Ansible vmware_guest无法进入vmware vSphere vCenter

时间:2017-11-10 09:57:04

标签: ssh ansible vmware vsphere

我正在尝试使用ansible设置虚拟机。但是,ansible一直停留在模板任务的Deploy guest虚拟机上。

使用-vvv,我得到了以下日志。

尝试通过ssh pubkey auth登录时:

TASK [Deploy guest from template] 
task path: /home/wilb/Development/vcenter_demo/vcenter_demo.yml:12
Using module file /usr/lib/python2.7/site-packages/ansible/modules/cloud/vmware/vmware_guest.py
<vcenter.mycompany.com> ESTABLISH SSH CONNECTION FOR USER: root
<vcenter.mycompany.com> SSH: EXEC ssh -C -o ControlMaster=auto 
  -o ControlPersist=60s -o KbdInteractiveAuthentication=no 
  -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
  -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 
  -o ControlPath=/home/wilb/.ansible/cp/982c3c15ab 
  vcenter.mycompany.com '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''

当我尝试使用--ask-pass时,它会卡在这里:

TASK [Deploy guest from template] *******************************************************************************************************
task path: /home/wilb/Development/vcenter_demo/vcenter_demo.yml:14
Using module file /usr/lib/python2.7/site-packages/ansible/modules/cloud/vmware/vmware_guest.py
<vcenter.mycompany.com> ESTABLISH SSH CONNECTION FOR USER: root
<vcenter.mycompany.com> SSH: EXEC sshpass -d12 ssh -C 
  -o ControlMaster=auto -o ControlPersist=60s -o User=root 
  -o ConnectTimeout=10 
  -o ControlPath=/home/wilb/.ansible/cp/982c3c15ab 
  vcenter.mycompany.com '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''

我可以手动登录vCenter。但是,要访问shell,我首先要输入:&#34; shell&#34;在vCenter中;默认情况下,这是一些奇怪的自定义提示。

如何正确登录vcenter以自动部署VM?

系统

  • 控制器操作系统:Fedora 26
  • Ansible:2.4.1
  • vCenter:6.5.0.1000

1 个答案:

答案 0 :(得分:1)

  

Ansible vmware_guest无法进入vmware vSphere vCenter

不应该。

你应该拨打大部分&#34;云&#34;本地机器的模块。
看看vmware_guest的例子:到处都有delegate_to: localhost