Skip to content

Commit 1f84c5d

Browse files
Add possibility to skip certificate validation (#131)
1 parent 58075b9 commit 1f84c5d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

plugins/doc_fragments/cloudstack.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ class ModuleDocFragment(object):
4848
- Verify CA authority cert file.
4949
- If not given, the C(CLOUDSTACK_VERIFY) env variable is considered.
5050
type: str
51+
validate_certs:
52+
description:
53+
- If V(false), SSL certificates will not be validated.
54+
- If not given, the C(CLOUDSTACK_DANGEROUS_NO_TLS_VERIFY) env variable is considered.
55+
- This should only be used on personally controlled sites using self-signed certificates.
56+
type: bool
57+
default: true
5158
requirements:
5259
- python >= 2.6
5360
- cs >= 0.9.0

plugins/module_utils/cloudstack.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def cs_argument_spec():
3535
api_http_method=dict(type='str', fallback=(env_fallback, ['CLOUDSTACK_METHOD']), choices=['get', 'post'], default='get'),
3636
api_timeout=dict(type='int', fallback=(env_fallback, ['CLOUDSTACK_TIMEOUT']), default=10),
3737
api_verify_ssl_cert=dict(type='str', fallback=(env_fallback, ['CLOUDSTACK_VERIFY'])),
38+
validate_certs=dict(type='str', fallback=(env_fallback, ['CLOUDSTACK_DANGEROUS_NO_TLS_VERIFY']), default=True),
3839
)
3940

4041

@@ -121,13 +122,16 @@ def get_api_config(self):
121122
'timeout': self.module.params.get('api_timeout'),
122123
'method': self.module.params.get('api_http_method'),
123124
'verify': self.module.params.get('api_verify_ssl_cert'),
125+
'dangerous_no_tls_verify': self.module.params.get('validate_certs'),
124126
}
127+
125128
self.result.update({
126129
'api_url': api_config['endpoint'],
127130
'api_key': api_config['key'],
128131
'api_timeout': int(api_config['timeout']),
129132
'api_http_method': api_config['method'],
130133
'api_verify_ssl_cert': api_config['verify'],
134+
'validate_certs': api_config['dangerous_no_tls_verify'],
131135
})
132136
return api_config
133137

0 commit comments

Comments
 (0)