|
|
@ -65,6 +65,15 @@ options:
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: paravirtual
|
|
|
|
default: paravirtual
|
|
|
|
choices: ["paravirtual", "hvm"]
|
|
|
|
choices: ["paravirtual", "hvm"]
|
|
|
|
|
|
|
|
validate_certs:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- If C(no), SSL certificates will not be validated. This should only
|
|
|
|
|
|
|
|
be set to C(no) used on personally controlled sites using self-signed
|
|
|
|
|
|
|
|
certificates. Prior to 1.9.3 the code defaulted to C(no).
|
|
|
|
|
|
|
|
required: false
|
|
|
|
|
|
|
|
default: 'yes'
|
|
|
|
|
|
|
|
choices: ['yes', 'no']
|
|
|
|
|
|
|
|
version_added: '1.9.3'
|
|
|
|
|
|
|
|
|
|
|
|
author: Lorin Hochstein
|
|
|
|
author: Lorin Hochstein
|
|
|
|
'''
|
|
|
|
'''
|
|
|
@ -102,11 +111,12 @@ AWS_REGIONS = ['ap-northeast-1',
|
|
|
|
|
|
|
|
|
|
|
|
def get_url(module, url):
|
|
|
|
def get_url(module, url):
|
|
|
|
""" Get url and return response """
|
|
|
|
""" Get url and return response """
|
|
|
|
try:
|
|
|
|
|
|
|
|
r = urllib2.urlopen(url)
|
|
|
|
r, info = fetch_url(module, url)
|
|
|
|
except (urllib2.HTTPError, urllib2.URLError), e:
|
|
|
|
if info['status'] != 200:
|
|
|
|
code = getattr(e, 'code', -1)
|
|
|
|
# Backwards compat
|
|
|
|
module.fail_json(msg="Request failed: %s" % str(e), status_code=code)
|
|
|
|
info['status_code'] = info['status']
|
|
|
|
|
|
|
|
module.fail_json(**info)
|
|
|
|
return r
|
|
|
|
return r
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -182,7 +192,8 @@ def main():
|
|
|
|
choices=['i386', 'amd64']),
|
|
|
|
choices=['i386', 'amd64']),
|
|
|
|
region=dict(required=False, default='us-east-1', choices=AWS_REGIONS),
|
|
|
|
region=dict(required=False, default='us-east-1', choices=AWS_REGIONS),
|
|
|
|
virt=dict(required=False, default='paravirtual',
|
|
|
|
virt=dict(required=False, default='paravirtual',
|
|
|
|
choices=['paravirtual', 'hvm'])
|
|
|
|
choices=['paravirtual', 'hvm']),
|
|
|
|
|
|
|
|
validate_certs = dict(required=False, default=True, type='bool'),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
module = AnsibleModule(argument_spec=arg_spec)
|
|
|
|
module = AnsibleModule(argument_spec=arg_spec)
|
|
|
|
distro = module.params['distro']
|
|
|
|
distro = module.params['distro']
|
|
|
@ -196,6 +207,7 @@ def main():
|
|
|
|
|
|
|
|
|
|
|
|
# this is magic, see lib/ansible/module_common.py
|
|
|
|
# this is magic, see lib/ansible/module_common.py
|
|
|
|
from ansible.module_utils.basic import *
|
|
|
|
from ansible.module_utils.basic import *
|
|
|
|
|
|
|
|
from ansible.module_utils.urls import *
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|
|
|
|
main()
|
|
|
|