yasensim / vsphere-lab-deploy

Ansible playbook to automate deployment of vCenter and nested ESXi hosts
65 stars 48 forks source link

pyvmomi module requirement issue #1

Open gratchie opened 6 years ago

gratchie commented 6 years ago

I'm getting an error, pyvmomi module error when running the playbook. I tried to add delegate_to: localhost in the task but still getting the same error. I have the pyvmomi module installed, python 2.7.10. Running this on OSX 10.13 (high sierra)

# pip show pyvmomi
Name: pyvmomi
Version: 6.5.0.2017.5.post1
Summary: VMware vSphere Python SDK
Home-page: https://github.com/vmware/pyvmomi
Author: VMware, Inc.
Author-email: jhu@vmware.com
License: License :: OSI Approved :: Apache Software License
Location: /Library/Python/2.7/site-packages
Requires: requests, six
TASK [Create Datacenter] ******************************************************************************************************
task path: /Users/gr/Documents/vmware-lab/vsphere-lab-deploy-gracie/playbooks/deployVC.yml:102
Using module file /usr/local/Cellar/ansible/2.4.3.0/libexec/lib/python2.7/site-packages/ansible/modules/cloud/vmware/vmware_datacenter.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: gr
<localhost> EXEC /bin/sh -c 'echo ~ && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/gr/.ansible/tmp/ansible-tmp-1517708521.27-251117388112169 `" && echo ansible-tmp-1517708521.27-251117388112169="` echo /Users/gracet/.ansible/tmp/ansible-tmp-1517708521.27-251117388112169 `" ) && sleep 0'
<localhost> PUT /var/folders/_y/pjvwjs_11f75c08bwq9xslv1pcmp50/T/tmp74u9Qx TO /Users/gr/.ansible/tmp/ansible-tmp-1517708521.27-251117388112169/vmware_datacenter.py
<localhost> EXEC /bin/sh -c 'chmod u+x /Users/gr/.ansible/tmp/ansible-tmp-1517708521.27-251117388112169/ /Users/gracet/.ansible/tmp/ansible-tmp-1517708521.27-251117388112169/vmware_datacenter.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/local/Cellar/ansible/2.4.3.0/libexec/bin/python /Users/gracet/.ansible/tmp/ansible-tmp-1517708521.27-251117388112169/vmware_datacenter.py; rm -rf "/Users/gr/.ansible/tmp/ansible-tmp-1517708521.27-251117388112169/" > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/var/folders/_y/pjvwjs_11f75c08bwq9xslv1pcmp50/T/ansible_bBuo8n/ansible_module_vmware_datacenter.py", line 69, in <module>
    from pyVmomi import vim, vmodl

fatal: [localhost -> localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "datacenter_name": "Datacenter",
            "hostname": "172.16.0.1",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "state": "present",
            "username": "administrator@gracie.local",
            "validate_certs": false
        }
    },
    "msg": "pyvmomi is required for this module"
}
yasensim commented 6 years ago

It looks like the python that serves ansible cannot find pyvmomi. Is it possible you have two python versions installed? You can check ansible --version Honestly, I have never test it on Mac, so it is possible that you will encounter other issues when you fix that. It has been validated with Ubuntu 14.04 only. I plan to re-work it but cannot commit exact time.