Added ap-northeast-2 region (#2849)

This commit is contained in:
William Holroyd 2016-04-12 17:29:04 -04:00 committed by Matt Clay
parent 5a48a2e93e
commit 42d784c24b

View file

@ -54,13 +54,14 @@ import re
socket.setdefaulttimeout(5)
class Ec2Metadata(object):
class Ec2Metadata(object):
ec2_metadata_uri = 'http://169.254.169.254/latest/meta-data/'
ec2_sshdata_uri = 'http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key'
ec2_userdata_uri = 'http://169.254.169.254/latest/user-data/'
AWS_REGIONS = ('ap-northeast-1',
'ap-northeast-2',
'ap-southeast-1',
'ap-southeast-2',
'eu-central-1',
@ -129,7 +130,7 @@ class Ec2Metadata(object):
"""Change ':'' and '-' to '_' to ensure valid template variable names"""
for (key, value) in data.items():
if ':' in key or '-' in key:
newkey = key.replace(':','_').replace('-','_')
newkey = key.replace(':', '_').replace('-', '_')
del data[key]
data[newkey] = value
@ -161,12 +162,13 @@ class Ec2Metadata(object):
self.add_ec2_region(data)
return data
def main():
argument_spec = url_argument_spec()
module = AnsibleModule(
argument_spec = argument_spec,
supports_check_mode = True,
argument_spec=argument_spec,
supports_check_mode=True,
)
ec2_facts = Ec2Metadata(module).run()
@ -174,6 +176,7 @@ def main():
module.exit_json(**ec2_facts_result)
# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.urls import *