# Ansible 2.0 VMWare modules

**URL:** <https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [January 13, 2016, 5:54pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202 "2016-01-13T17:54:29Z")\
**Posts on this page:** 16\
**Page:** 2

<div class="post-metadata">

**Author:** ![Jonathan\_Frappier](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@Jonathan\_Frappier](https://forum.ansible.com/u/Jonathan_Frappier)\
**Post date:** [February 18, 2016, 1:56pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/21 "2016-02-18T13:56:18Z")

</div>

So I’ve tried with two different environments, one vSphere 6, one with 5.5 and it does’t seem to work. Always comes back with [SSL: CERTIFICATE\_VERIFY\_FAILED] even when set to false

---

<div class="post-metadata">

**Author:** ![Vinson\_Xing](https://avatars.discourse-cdn.com/v4/letter/v/a88e57/32.png) [@Vinson\_Xing](https://forum.ansible.com/u/Vinson_Xing)\
**Post date:** [March 5, 2016, 3:19pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/22 "2016-03-05T15:19:54Z")

</div>

I installed the ansible from devel branch, I got the same issue even set validate\_certs to false.  
My test environment:

Ubuntu: 14.04  
Python: 2.7.6  
vSphere 5.5

---

<div class="post-metadata">

**Author:** ![Jonathan\_Frappier](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@Jonathan\_Frappier](https://forum.ansible.com/u/Jonathan_Frappier)\
**Post date:** [March 5, 2016, 10:06pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/23 "2016-03-05T22:06:08Z")

</div>

I’ll add that I also tried on Ubuntu 15.04 w Python 2.7.10

---

<div class="post-metadata">

**Author:** ![Larry\_Smith1](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@Larry\_Smith1](https://forum.ansible.com/u/Larry_Smith1)\
**Post date:** [March 9, 2016, 3:34pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/24 "2016-03-09T15:34:12Z")

</div>

So it appears this is still an issue? Would be awesome to get this fixed in the GA release so we can proceed with testing out the modules w/out hacks. Also not assuming that every environment uses self-signed certs should have been considered initially???

---

<div class="post-metadata">

**Author:** ![digitalsy](https://avatars.discourse-cdn.com/v4/letter/d/2bfe46/32.png) [@digitalsy](https://forum.ansible.com/u/digitalsy)\
**Post date:** [March 10, 2016, 10:50pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/25 "2016-03-10T22:50:10Z")

</div>

I’ve been struggling with these SSL CERTIFICATE\_VERIFY\_ISSUES also. I can’t get validate\_certs: false to work, I’ve even downloaded the unsigned cert, converted it to PEM and added it to /usr/local/etc/openssl/certs and run /usr/local/opt/openssl/bin/c\_rehash to no avail. Something is definitely broken with the validate\_certs parameter (at least on my OSX machine running python 2.7.11 and ansible (2.0.1.0))

The only way I’ve found to get this working, which might work for you guys is to open up the following file:

./ansible/modules/core/cloud/vmware/vsphere\_guest.py (or whatever module vmware module you’re using that connects via SSL).

This file is usually located in your /Library/Python/2.7/site-packages/ folder (OSX)  
or  
/usr/lib/python2.7/site-packages/ (redhat/centos)

And ADD the following lines below the initial comments:

import requests, ssl  
requests.packages.urllib3.disable\_warnings()  
try:  
\_create\_unverified\_https\_context = ssl.\_create\_unverified\_context  
except AttributeError:  
pass  
else:  
ssl.\_create\_default\_https\_context = \_create\_unverified\_https\_context

Also, make sure you have the requests module installed.

Hope this gets fixed soon, but in the meantime that should work to completely disable SSL and make everything super unsecure 🙂

---

<div class="post-metadata">

**Author:** ![Jonathan\_Frappier](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@Jonathan\_Frappier](https://forum.ansible.com/u/Jonathan_Frappier)\
**Post date:** [March 10, 2016, 11:10pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/26 "2016-03-10T23:10:54Z")

</div>

Thanks for the tips Julian! Hoping to show this off at work without any hacks. Don’t want it to come off as glitchy and unsupportable

---

<div class="post-metadata">

**Author:** ![kamil.szczygiel](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@kamil.szczygiel](https://forum.ansible.com/u/kamil.szczygiel)\
**Post date:** [March 15, 2016, 9:00am UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/27 "2016-03-15T09:00:44Z")

</div>

I’ve tested it with the same configuration and I can confirm it’s not working. I’ll try to fix it until the end of week.

---

<div class="post-metadata">

**Author:** ![kamil.szczygiel](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@kamil.szczygiel](https://forum.ansible.com/u/kamil.szczygiel)\
**Post date:** [March 16, 2016, 8:38am UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/28 "2016-03-16T08:38:35Z")

</div>

I’ve created PR with a small fix ([https://github.com/ansible/ansible/pull/14988](https://github.com/ansible/ansible/pull/14988)) that I’ve tested with Ubuntu 15.10/14.04 and Python 2.7.11. This should resolve the issue with Python \> 2.7.9. I"m not sure about older python, since it shouldn’t validate certificates in a first place.

Kamil

---

<div class="post-metadata">

**Author:** ![Jonathan\_Frappier](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@Jonathan\_Frappier](https://forum.ansible.com/u/Jonathan_Frappier)\
**Post date:** [March 16, 2016, 12:09pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/29 "2016-03-16T12:09:56Z")

</div>

Thanks, look forward to testing. As I sit here now, I also wonder if this is a pyVmomi specific issue…

---

<div class="post-metadata">

**Author:** ![kamil.szczygiel](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@kamil.szczygiel](https://forum.ansible.com/u/kamil.szczygiel)\
**Post date:** [March 16, 2016, 12:49pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/30 "2016-03-16T12:49:26Z")

</div>

I had the same thing on my mind this morning, but I’m not certain if this is a pyvmomi issue.

Kamil

---

<div class="post-metadata">

**Author:** ![Jonathan\_Frappier](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@Jonathan\_Frappier](https://forum.ansible.com/u/Jonathan_Frappier)\
**Post date:** [March 16, 2016, 1:01pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/31 "2016-03-16T13:01:17Z")

</div>

In any case, thank you so much for looking into it. I’ll keep an eye on the PR to see when it is merged.

---

<div class="post-metadata">

**Author:** ![kamil.szczygiel](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@kamil.szczygiel](https://forum.ansible.com/u/kamil.szczygiel)\
**Post date:** [March 16, 2016, 1:08pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/32 "2016-03-16T13:08:51Z")

</div>

If you’d like to try it out ASAP, my fork is up to date with ansible main devel.

Kamil

---

<div class="post-metadata">

**Author:** ![Ben\_Lutgens](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@Ben\_Lutgens](https://forum.ansible.com/u/Ben_Lutgens)\
**Post date:** [March 16, 2016, 5:10pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/33 "2016-03-16T17:10:29Z")

</div>

That would be fantastic. I think there’s a great deal of people using self-signed certs with vsphere.

---

<div class="post-metadata">

**Author:** ![Victor1](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@Victor1](https://forum.ansible.com/u/Victor1)\
**Post date:** [May 14, 2017, 7:53pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/34 "2017-05-14T19:53:47Z")

</div>

Hi Jonathan,

I was so happy to see this post. I have struggled almost a day for this but could not rersolve this.  
did you have any luck on this issue…

Thanks,  
Vijay

---

<div class="post-metadata">

**Author:** ![Victor1](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@Victor1](https://forum.ansible.com/u/Victor1)\
**Post date:** [May 14, 2017, 7:54pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/35 "2017-05-14T19:54:35Z")

</div>

Hi Kamil,

I am facing the similar issue related to certificate. ☹ do you know the solution ?

Thanks,  
Vijay

---

<div class="post-metadata">

**Author:** ![Jonathan\_Frappier](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@Jonathan\_Frappier](https://forum.ansible.com/u/Jonathan_Frappier)\
**Post date:** [May 14, 2017, 8:05pm UTC](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202/36 "2017-05-14T20:05:31Z")

</div>

Hi Vijay,

I have a friend who may have a solution, though I have not been able to test. You can try

add the below into the file: /usr/lib/python2.7/site-packages/pyVim/connect.py

try:  
if sslContext is not None and sslContext.verify\_mode == ssl.CERT\_NONE:  
sock = requests.get(url, verify=False)  
else:  
sock = requests.get(url, verify=False)

[Previous page](https://forum.ansible.com/t/ansible-2-0-vmware-modules/20202.md?page=1)
