diff --git a/lib/ansible/modules/cloud/vmware/_vsphere_guest.py b/lib/ansible/modules/cloud/vmware/_vsphere_guest.py index 7093964fd0..6109ab150d 100644 --- a/lib/ansible/modules/cloud/vmware/_vsphere_guest.py +++ b/lib/ansible/modules/cloud/vmware/_vsphere_guest.py @@ -1808,7 +1808,7 @@ def main(): module.fail_json(msg='pysphere does not support verifying certificates with python < 2.7.9. Either update python or set ' 'validate_certs=False on the task') - if not validate_certs: + if not validate_certs and hasattr(ssl, 'SSLContext'): ssl._create_default_https_context = ssl._create_unverified_context try: