1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Adding validate_certs to all modules that use fetch_url

This commit is contained in:
James Cammarata 2014-03-12 10:19:22 -05:00
parent cfabc2e28a
commit a9017af2bb
11 changed files with 99 additions and 5 deletions

View file

@ -155,7 +155,7 @@ def url_argument_spec():
def fetch_url(module, url, data=None, headers=None, method=None, def fetch_url(module, url, data=None, headers=None, method=None,
use_proxy=False, validate_certs=True, force=False, last_mod_time=None, timeout=10): use_proxy=False, force=False, last_mod_time=None, timeout=10):
''' '''
Fetches a file from an HTTP/FTP server using urllib2 Fetches a file from an HTTP/FTP server using urllib2
''' '''
@ -171,6 +171,9 @@ def fetch_url(module, url, data=None, headers=None, method=None,
handlers = [] handlers = []
info = dict(url=url) info = dict(url=url)
# Get validate_certs from the module params
validate_certs = module.params.get('validate_certs', True)
parsed = urlparse.urlparse(url) parsed = urlparse.urlparse(url)
if parsed[0] == 'https': if parsed[0] == 'https':
if not HAS_SSL and validate_certs: if not HAS_SSL and validate_certs:

View file

@ -21,7 +21,15 @@ DOCUMENTATION = '''
module: ec2_facts module: ec2_facts
short_description: Gathers facts about remote hosts within ec2 (aws) short_description: Gathers facts about remote hosts within ec2 (aws)
version_added: "1.0" version_added: "1.0"
options: {} options:
validate_certs:
description:
- If C(no), SSL certificates will not be validated. This should only be used
on personally controlled sites using self-signed certificates.
required: false
default: 'yes'
choices: ['yes', 'no']
version_added: 1.5.1
description: description:
- This module fetches data from the metadata servers in ec2 (aws). - This module fetches data from the metadata servers in ec2 (aws).
Eucalyptus cloud provides a similar service and this module should Eucalyptus cloud provides a similar service and this module should

View file

@ -73,6 +73,14 @@ options:
default: None default: None
aliases: [] aliases: []
choices: ['kv'] choices: ['kv']
validate_certs:
description:
- If C(no), SSL certificates will not be validated. This should only be used
on personally controlled sites using self-signed certificates.
required: false
default: 'yes'
choices: ['yes', 'no']
version_added: 1.5.1
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -117,7 +125,8 @@ def main():
wait_for_ring=dict(default=False, type='int'), wait_for_ring=dict(default=False, type='int'),
wait_for_service=dict( wait_for_service=dict(
required=False, default=None, choices=['kv']) required=False, default=None, choices=['kv'])
) ),
validate_certs = dict(default='yes', type='bool'),
) )

View file

@ -58,6 +58,14 @@ options:
description: description:
- Organizations boundary API KEY - Organizations boundary API KEY
required: true required: true
validate_certs:
description:
- If C(no), SSL certificates will not be validated. This should only be used
on personally controlled sites using self-signed certificates.
required: false
default: 'yes'
choices: ['yes', 'no']
version_added: 1.5.1
notes: notes:
- This module does not yet support boundary tags. - This module does not yet support boundary tags.
@ -221,6 +229,7 @@ def main():
name=dict(required=False), name=dict(required=False),
apikey=dict(required=True), apikey=dict(required=True),
apiid=dict(required=True), apiid=dict(required=True),
validate_certs = dict(default='yes', type='bool'),
) )
) )

View file

@ -54,6 +54,14 @@ options:
description: ["An arbitrary string to use for aggregation."] description: ["An arbitrary string to use for aggregation."]
required: false required: false
default: null default: null
validate_certs:
description:
- If C(no), SSL certificates will not be validated. This should only be used
on personally controlled sites using self-signed certificates.
required: false
default: 'yes'
choices: ['yes', 'no']
version_added: 1.5.1
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -89,7 +97,8 @@ def main():
choices=['nagios', 'hudson', 'jenkins', 'user', 'my apps', choices=['nagios', 'hudson', 'jenkins', 'user', 'my apps',
'feed', 'chef', 'puppet', 'git', 'bitbucket', 'fabric', 'feed', 'chef', 'puppet', 'git', 'bitbucket', 'fabric',
'capistrano'] 'capistrano']
) ),
validate_certs = dict(default='yes', type='bool'),
) )
) )

View file

@ -63,6 +63,14 @@ options:
description: description:
- The environment for this deployment - The environment for this deployment
required: false required: false
validate_certs:
description:
- If C(no), SSL certificates will not be validated. This should only be used
on personally controlled sites using self-signed certificates.
required: false
default: 'yes'
choices: ['yes', 'no']
version_added: 1.5.1
# informational: requirements for nodes # informational: requirements for nodes
requirements: [ urllib, urllib2 ] requirements: [ urllib, urllib2 ]
@ -92,6 +100,7 @@ def main():
user=dict(required=False), user=dict(required=False),
appname=dict(required=False), appname=dict(required=False),
environment=dict(required=False), environment=dict(required=False),
validate_certs = dict(default='yes', type='bool'),
), ),
supports_check_mode=True supports_check_mode=True
) )

View file

@ -60,6 +60,15 @@ options:
default: Created by Ansible default: Created by Ansible
choices: [] choices: []
aliases: [] aliases: []
validate_certs:
description:
- If C(no), SSL certificates will not be validated. This should only be used
on personally controlled sites using self-signed certificates.
required: false
default: 'yes'
choices: ['yes', 'no']
version_added: 1.5.1
notes: notes:
- This module does not yet have support to end maintenance windows. - This module does not yet have support to end maintenance windows.
''' '''
@ -135,7 +144,8 @@ def main():
passwd=dict(required=True), passwd=dict(required=True),
service=dict(required=False), service=dict(required=False),
hours=dict(default='1', required=False), hours=dict(default='1', required=False),
desc=dict(default='Created by Ansible', required=False) desc=dict(default='Created by Ansible', required=False),
validate_certs = dict(default='yes', type='bool'),
) )
) )

View file

@ -73,6 +73,15 @@ options:
choices: [ 'present', 'absent' ] choices: [ 'present', 'absent' ]
default: null default: null
validate_certs:
description:
- If C(no), SSL certificates will not be validated. This should only be used
on personally controlled sites using self-signed certificates.
required: false
default: 'yes'
choices: ['yes', 'no']
version_added: 1.5.1
notes: notes:
- The DNS Made Easy service requires that machines interacting with the API have the proper time and timezone set. Be sure you are within a few seconds of actual time by using NTP. - The DNS Made Easy service requires that machines interacting with the API have the proper time and timezone set. Be sure you are within a few seconds of actual time by using NTP.
- This module returns record(s) in the "result" element when 'state' is set to 'present'. This value can be be registered and used in your playbooks. - This module returns record(s) in the "result" element when 'state' is set to 'present'. This value can be be registered and used in your playbooks.
@ -239,6 +248,7 @@ def main():
'A', 'AAAA', 'CNAME', 'HTTPRED', 'MX', 'NS', 'PTR', 'SRV', 'TXT']), 'A', 'AAAA', 'CNAME', 'HTTPRED', 'MX', 'NS', 'PTR', 'SRV', 'TXT']),
record_value=dict(required=False), record_value=dict(required=False),
record_ttl=dict(required=False, default=1800, type='int'), record_ttl=dict(required=False, default=1800, type='int'),
validate_certs = dict(default='yes', type='bool'),
), ),
required_together=( required_together=(
['record_value', 'record_ttl', 'record_type'] ['record_value', 'record_ttl', 'record_type']

View file

@ -76,6 +76,14 @@ options:
description: description:
- (inbox only) Link associated with the message. This will be used to link the message subject in Team Inbox. - (inbox only) Link associated with the message. This will be used to link the message subject in Team Inbox.
required: false required: false
validate_certs:
description:
- If C(no), SSL certificates will not be validated. This should only be used
on personally controlled sites using self-signed certificates.
required: false
default: 'yes'
choices: ['yes', 'no']
version_added: 1.5.1
# informational: requirements for nodes # informational: requirements for nodes
requirements: [ urllib, urllib2 ] requirements: [ urllib, urllib2 ]
@ -116,6 +124,7 @@ def main():
project=dict(required=False), project=dict(required=False),
tags=dict(required=False), tags=dict(required=False),
link=dict(required=False), link=dict(required=False),
validate_certs = dict(default='yes', type='bool'),
), ),
supports_check_mode=True supports_check_mode=True
) )

View file

@ -31,6 +31,14 @@ options:
description: description:
- Icon for the service - Icon for the service
required: false required: false
validate_certs:
description:
- If C(no), SSL certificates will not be validated. This should only be used
on personally controlled sites using self-signed certificates.
required: false
default: 'yes'
choices: ['yes', 'no']
version_added: 1.5.1
author: Jonas Pfenniger <zimbatm@zimbatm.com> author: Jonas Pfenniger <zimbatm@zimbatm.com>
''' '''
@ -71,6 +79,7 @@ def main():
service = dict(type='str', default='ansible'), service = dict(type='str', default='ansible'),
url = dict(type='str', default=None), url = dict(type='str', default=None),
icon_url = dict(type='str', default=None), icon_url = dict(type='str', default=None),
validate_certs = dict(default='yes', type='bool'),
) )
) )

View file

@ -46,6 +46,14 @@ options:
required: false required: false
default: 'yes' default: 'yes'
choices: [ "yes", "no" ] choices: [ "yes", "no" ]
validate_certs:
description:
- If C(no), SSL certificates will not be validated. This should only be used
on personally controlled sites using self-signed certificates.
required: false
default: 'yes'
choices: ['yes', 'no']
version_added: 1.5.1
# informational: requirements for nodes # informational: requirements for nodes
requirements: [ urllib, urllib2 ] requirements: [ urllib, urllib2 ]
@ -104,6 +112,7 @@ def main():
"purple", "gray", "random"]), "purple", "gray", "random"]),
msg_format=dict(default="text", choices=["text", "html"]), msg_format=dict(default="text", choices=["text", "html"]),
notify=dict(default=True, type='bool'), notify=dict(default=True, type='bool'),
validate_certs = dict(default='yes', type='bool'),
), ),
supports_check_mode=True supports_check_mode=True
) )