From 1d113c384ef8279f975e9ae699b4e79c369a31ab Mon Sep 17 00:00:00 2001 From: Alexey Kalinin Date: Sat, 14 May 2016 11:02:07 -0700 Subject: [PATCH] Fix issue with latest pyvmomi and certificate validation --- lib/ansible/module_utils/vmware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/vmware.py b/lib/ansible/module_utils/vmware.py index b2ac9750394..75f680916cf 100644 --- a/lib/ansible/module_utils/vmware.py +++ b/lib/ansible/module_utils/vmware.py @@ -196,7 +196,7 @@ def connect_to_api(module, disconnect_atexit=True): service_instance = connect.SmartConnect(host=hostname, user=username, pwd=password) except vim.fault.InvalidLogin as invalid_login: module.fail_json(msg=invalid_login.msg, apierror=str(invalid_login)) - except requests.ConnectionError as connection_error: + except (requests.ConnectionError, ssl.SSLError) as connection_error: if '[SSL: CERTIFICATE_VERIFY_FAILED]' in str(connection_error) and not validate_certs: context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) context.verify_mode = ssl.CERT_NONE