module connect_to_api from vmware has no attribute 'SSLContext'

291 views
Skip to first unread message

Josu Vilda

unread,
Nov 17, 2017, 3:38:56 AM11/17/17
to Ansible Project

Hello,
I'm having problems with module vmware_guest_snapshot. Any solution?


[root@ges1ansibledes ansible]# ansible --version
ansible
2.4.1.0
  config file
= /etc/ansible/ansible.cfg
  configured
module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python
module location = /usr/lib/python2.6/site-packages/ansible
  executable location
= /usr/bin/ansible
  python version
= 2.6.6 (r266:84292, Nov 21 2013, 10:50:32) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]



---
- hosts: "localhost"
  user
: *****
  become
: root
  gather_facts
: False
  tasks
:
   
- name: Create snapshot
      vmware_guest_snapshot
:
        hostname
: "{{ vCenter }}"
        username
: "******"
        password
: "******"
        datacenter
: "{{ datacenter_name }}"
        name
: "{{ vmw_name }}"
        state
: present
        snapshot_name
: "{{ snapname }}"
        description
: "{{ snapdescript }}"
        validate_certs
: false





The full traceback is:
Traceback (most recent call last):
 
File "/tmp/ansible_hwi8NY/ansible_module_vmware_guest_snapshot.py", line 357, in <module>
    main
()
 
File "/tmp/ansible_hwi8NY/ansible_module_vmware_guest_snapshot.py", line 329, in main
    pyv
= PyVmomiHelper(module)
 
File "/tmp/ansible_hwi8NY/ansible_module_vmware_guest_snapshot.py", line 211, in __init__
   
self.content = connect_to_api(self.module)
 
File "/tmp/ansible_hwi8NY/ansible_modlib.zip/ansible/module_utils/vmware.py", line 398, in connect_to_api
AttributeError: 'module' object has no attribute 'SSLContext'

fatal
: [localhost]: FAILED! => {
   
"changed": false,
   
"failed": true,
   
"module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_hwi8NY/ansible_module_vmware_guest_snapshot.py\", line 357, in <module>\n    main()\n  File \"/tmp/ansible_hwi8NY/ansible_module_vmware_guest_snapshot.py\", line 329, in main\n    pyv = PyVmomiHelper(module)\n  File \"/tmp/ansible_hwi8NY/ansible_module_vmware_guest_snapshot.py\", line 211, in __init__\n    self.content = connect_to_api(self.module)\n  File \"/tmp/ansible_hwi8NY/ansible_modlib.zip/ansible/module_utils/vmware.py\", line 398, in connect_to_api\nAttributeError: 'module' object has no attribute 'SSLContext'\n",
   
"module_stdout": "",
   
"msg": "MODULE FAILURE",
   
"rc": 0


Josu Vilda

unread,
Nov 17, 2017, 7:57:38 AM11/17/17
to Ansible Project
According to the documentation on the web http://docs.ansible.com/ansible/latest/vmware_guest_snapshot_module.html vmware_guest_snapshot - Manages virtual machines snapshots in vcenter  Requirements : python >= 2.6PyVmomi but ...


 - settings "validate_certs: True" option,  it shows :
pyVim does not support changing verification mode with python < 2.7.9. Either update python or or use validate_certs=false"
 - settings "validate_certs: False" option,  it shows : 
AttributeError: 'module' object has no attribute 'SSLContext'

I try with pyvmomi  5.5.0 and 6.0.0

Name: pyvmomi
Version: 6.0.0
Summary: VMware vSphere Python SDK
Author: VMware, Inc.
Author-email: jhu@***.com
License: License :: OSI Approved :: Apache Software License
Location: /usr/lib/python2.6/site-packages
Requires: requests, six


 
Reply all
Reply to author
Forward
0 new messages