简体   繁体   中英

Ansible vmware_guest cannot ssh into vmware vSphere vCenter

I'm trying to setup a virtual machine with ansible. However, ansible keeps getting stuck on the Deploy guest from template task.

Using -vvv, I got the following logs.

When attempting to log in via 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'"'"''

When I try to use --ask-pass, it gets stuck here:

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'"'"''

I can login to the vCenter manually. However, to access the shell, I first have to type: "shell" in the vCenter; by default it's some weird customized prompt.

How can I get ansible to log into vcenter properly to automatically deploy a VM?

System

  • Controller OS: Fedora 26
  • Ansible: 2.4.1
  • vCenter: 6.5.0.1000

Ansible vmware_guest cannot ssh into vmware vSphere vCenter

It should not.

You should call most of "cloud" modules from local machine.
Take a look at examples of vmware_guest : there's delegate_to: localhost everywhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM