updated to use shared region docs from ec2
This commit is contained in:
parent
8d3122169d
commit
205115ea1f
21 changed files with 83 additions and 108 deletions
|
@ -71,13 +71,9 @@ options:
|
|||
- Write throughput capacity (units) to provision.
|
||||
required: false
|
||||
default: 1
|
||||
region:
|
||||
description:
|
||||
- The AWS region to use. If not specified then the value of the EC2_REGION environment variable, if any, is used.
|
||||
required: false
|
||||
aliases: ['aws_region', 'ec2_region']
|
||||
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
"""
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -26,11 +26,6 @@ options:
|
|||
description:
|
||||
- the source region that AMI should be copied from
|
||||
required: true
|
||||
region:
|
||||
description:
|
||||
- the destination region that AMI should be copied to
|
||||
required: true
|
||||
aliases: ['aws_region', 'ec2_region', 'dest_region']
|
||||
source_image_id:
|
||||
description:
|
||||
- the id of the image in source region that should be copied
|
||||
|
@ -63,7 +58,9 @@ options:
|
|||
default: null
|
||||
|
||||
author: Amir Moulavi <amir.moulavi@gmail.com>
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -28,7 +28,9 @@ options:
|
|||
required: false
|
||||
default: null
|
||||
aliases: ['elb_ids', 'ec2_elbs']
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -74,8 +74,10 @@ options:
|
|||
source_dest_check:
|
||||
description:
|
||||
- By default, interfaces perform source/destination checks. NAT instances however need this check to be disabled. You can only specify this flag when the interface is being modified, not on creation.
|
||||
required: false
|
||||
extends_documentation_fragment: aws
|
||||
required: false
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -27,7 +27,9 @@ options:
|
|||
- The ID of the ENI. Pass this option to gather facts about a particular ENI, otherwise, all ENIs are returned.
|
||||
required: false
|
||||
default: null
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
@ -53,14 +55,14 @@ except ImportError:
|
|||
|
||||
|
||||
def get_error_message(xml_string):
|
||||
|
||||
|
||||
root = ET.fromstring(xml_string)
|
||||
for message in root.findall('.//Message'):
|
||||
for message in root.findall('.//Message'):
|
||||
return message.text
|
||||
|
||||
|
||||
|
||||
|
||||
def get_eni_info(interface):
|
||||
|
||||
|
||||
interface_info = {'id': interface.id,
|
||||
'subnet_id': interface.subnet_id,
|
||||
'vpc_id': interface.vpc_id,
|
||||
|
@ -72,7 +74,7 @@ def get_eni_info(interface):
|
|||
'source_dest_check': interface.source_dest_check,
|
||||
'groups': dict((group.id, group.name) for group in interface.groups),
|
||||
}
|
||||
|
||||
|
||||
if interface.attachment is not None:
|
||||
interface_info['attachment'] = {'attachment_id': interface.attachment.id,
|
||||
'instance_id': interface.attachment.instance_id,
|
||||
|
@ -81,23 +83,23 @@ def get_eni_info(interface):
|
|||
'attach_time': interface.attachment.attach_time,
|
||||
'delete_on_termination': interface.attachment.delete_on_termination,
|
||||
}
|
||||
|
||||
|
||||
return interface_info
|
||||
|
||||
|
||||
|
||||
def list_eni(connection, module):
|
||||
|
||||
|
||||
eni_id = module.params.get("eni_id")
|
||||
interface_dict_array = []
|
||||
|
||||
|
||||
try:
|
||||
all_eni = connection.get_all_network_interfaces(eni_id)
|
||||
except BotoServerError as e:
|
||||
module.fail_json(msg=get_error_message(e.args[2]))
|
||||
|
||||
|
||||
for interface in all_eni:
|
||||
interface_dict_array.append(get_eni_info(interface))
|
||||
|
||||
|
||||
module.exit_json(interfaces=interface_dict_array)
|
||||
|
||||
|
||||
|
@ -108,14 +110,14 @@ def main():
|
|||
eni_id = dict(default=None)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
module = AnsibleModule(argument_spec=argument_spec)
|
||||
|
||||
if not HAS_BOTO:
|
||||
module.fail_json(msg='boto required for this module')
|
||||
|
||||
|
||||
region, ec2_url, aws_connect_params = get_aws_connection_info(module)
|
||||
|
||||
|
||||
if region:
|
||||
try:
|
||||
connection = connect_to_aws(boto.ec2, region, **aws_connect_params)
|
||||
|
@ -125,11 +127,8 @@ def main():
|
|||
module.fail_json(msg="region must be specified")
|
||||
|
||||
list_eni(connection, module)
|
||||
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.ec2 import *
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
|
||||
|
||||
main()
|
||||
|
|
|
@ -27,19 +27,15 @@ options:
|
|||
- The VPC ID for the VPC in which to manage the Internet Gateway.
|
||||
required: true
|
||||
default: null
|
||||
region:
|
||||
description:
|
||||
- The AWS region to use. If not specified then the value of the EC2_REGION environment variable, if any, is used. See U(http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region)
|
||||
required: false
|
||||
default: null
|
||||
aliases: [ 'aws_region', 'ec2_region' ]
|
||||
state:
|
||||
description:
|
||||
- Create or terminate the IGW
|
||||
required: false
|
||||
default: present
|
||||
choices: [ 'present', 'absent' ]
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -61,8 +61,9 @@ options:
|
|||
description:
|
||||
- "VPC ID of the VPC in which to create the route table."
|
||||
required: true
|
||||
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -27,14 +27,9 @@ options:
|
|||
- A dict of filters to apply. Each dict item consists of a filter key and a filter value. See U(http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeRouteTables.html) for possible filters.
|
||||
required: false
|
||||
default: null
|
||||
region:
|
||||
description:
|
||||
- The AWS region to use. If not specified then the value of the EC2_REGION environment variable, if any, is used. See U(http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region)
|
||||
required: false
|
||||
default: null
|
||||
aliases: [ 'aws_region', 'ec2_region' ]
|
||||
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -49,8 +49,9 @@ options:
|
|||
- "VPC ID of the VPC in which to create the subnet."
|
||||
required: false
|
||||
default: null
|
||||
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
@ -230,14 +231,14 @@ def main():
|
|||
vpc_id = dict(default=None, required=True)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
|
||||
|
||||
|
||||
if not HAS_BOTO:
|
||||
module.fail_json(msg='boto is required for this module')
|
||||
|
||||
region, ec2_url, aws_connect_params = get_aws_connection_info(module)
|
||||
|
||||
|
||||
if region:
|
||||
try:
|
||||
connection = connect_to_aws(boto.vpc, region, **aws_connect_params)
|
||||
|
@ -269,4 +270,4 @@ from ansible.module_utils.ec2 import * # noqa
|
|||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
|
|
|
@ -27,14 +27,9 @@ options:
|
|||
- A dict of filters to apply. Each dict item consists of a filter key and a filter value. See U(http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSubnets.html) for possible filters.
|
||||
required: false
|
||||
default: null
|
||||
region:
|
||||
description:
|
||||
- The AWS region to use. If not specified then the value of the EC2_REGION environment variable, if any, is used. See U(http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region)
|
||||
required: false
|
||||
default: null
|
||||
aliases: [ 'aws_region', 'ec2_region' ]
|
||||
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
@ -127,4 +122,4 @@ from ansible.module_utils.basic import *
|
|||
from ansible.module_utils.ec2 import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
|
|
@ -36,12 +36,6 @@ options:
|
|||
- The passphrase for the instance key pair. The key must use DES or 3DES encryption for this module to decrypt it. You can use openssl to convert your password protected keys if they do not use DES or 3DES. ex) openssl rsa -in current_key -out new_key -des3.
|
||||
required: false
|
||||
default: null
|
||||
region:
|
||||
description:
|
||||
- The AWS region to use. Must be specified if ec2_url is not used. If not specified then the value of the EC2_REGION environment variable, if any, is used.
|
||||
required: false
|
||||
default: null
|
||||
aliases: [ 'aws_region', 'ec2_region' ]
|
||||
wait:
|
||||
version_added: "2.0"
|
||||
description:
|
||||
|
@ -56,7 +50,9 @@ options:
|
|||
required: false
|
||||
default: 120
|
||||
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -44,6 +44,8 @@ options:
|
|||
description:
|
||||
- The number of times to wait for the cluster to have an instance
|
||||
required: false
|
||||
extends_documentation_fragment:
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -56,6 +56,8 @@ options:
|
|||
description:
|
||||
- A value showing who or what started the task (for informational purposes)
|
||||
required: False
|
||||
extends_documentation_fragment:
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -52,7 +52,8 @@ options:
|
|||
- A list of names of volumes to be attached
|
||||
required: False
|
||||
type: list of name
|
||||
|
||||
extends_documentation_fragment:
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -89,7 +89,9 @@ options:
|
|||
default: 3
|
||||
choices: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
|
||||
author: "zimbatm (@zimbatm)"
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -46,7 +46,9 @@ options:
|
|||
- Comment associated with the zone
|
||||
required: false
|
||||
default: ''
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
author: "Christopher Troup (@minichate)"
|
||||
'''
|
||||
|
||||
|
|
|
@ -38,11 +38,6 @@ options:
|
|||
- The JSON policy as a string.
|
||||
required: false
|
||||
default: null
|
||||
region:
|
||||
description:
|
||||
- "AWS region to create the bucket in. If not set then the value of the AWS_REGION and EC2_REGION environment variables are checked, followed by the aws_region and ec2_region settings in the Boto config file. If none of those are set the region defaults to the S3 Location: US Standard."
|
||||
required: false
|
||||
default: null
|
||||
s3_url:
|
||||
description:
|
||||
- S3 URL endpoint for usage with Eucalypus, fakes3, etc. Otherwise assumes AWS
|
||||
|
@ -71,8 +66,9 @@ options:
|
|||
required: false
|
||||
default: no
|
||||
choices: [ 'yes', 'no' ]
|
||||
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -46,11 +46,6 @@ options:
|
|||
- "Prefix identifying one or more objects to which the rule applies. If no prefix is specified, the rule will apply to the whole bucket."
|
||||
required: false
|
||||
default: null
|
||||
region:
|
||||
description:
|
||||
- "AWS region to create the bucket in. If not set then the value of the AWS_REGION and EC2_REGION environment variables are checked, followed by the aws_region and ec2_region settings in the Boto config file. If none of those are set the region defaults to the S3 Location: US Standard."
|
||||
required: false
|
||||
default: null
|
||||
rule_id:
|
||||
description:
|
||||
- "Unique identifier for the rule. The value cannot be longer than 255 characters. A unique value for the rule will be generated if no value is provided."
|
||||
|
@ -84,8 +79,9 @@ options:
|
|||
- "Indicates when, in days, an object transitions to a different storage class. If transition_date is not specified, this parameter is required."
|
||||
required: false
|
||||
default: null
|
||||
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -26,11 +26,6 @@ options:
|
|||
description:
|
||||
- "Name of the s3 bucket."
|
||||
required: true
|
||||
region:
|
||||
description:
|
||||
- "AWS region to create the bucket in. If not set then the value of the AWS_REGION and EC2_REGION environment variables are checked, followed by the aws_region and ec2_region settings in the Boto config file. If none of those are set the region defaults to the S3 Location: US Standard."
|
||||
required: false
|
||||
default: null
|
||||
state:
|
||||
description:
|
||||
- "Enable or disable logging."
|
||||
|
@ -47,8 +42,9 @@ options:
|
|||
- "The prefix that should be prepended to the generated log files written to the target_bucket."
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
@ -181,4 +177,4 @@ from ansible.module_utils.basic import *
|
|||
from ansible.module_utils.ec2 import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
|
|
@ -61,13 +61,9 @@ options:
|
|||
- The receive message wait time in seconds.
|
||||
required: false
|
||||
default: null
|
||||
region:
|
||||
description:
|
||||
- The AWS region to use. If not specified then the value of the EC2_REGION environment variable, if any, is used.
|
||||
required: false
|
||||
aliases: ['aws_region', 'ec2_region']
|
||||
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
"""
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -58,7 +58,9 @@ options:
|
|||
default: null
|
||||
notes:
|
||||
- In order to use the assumed role in a following playbook task you must pass the access_key, access_secret and access_token
|
||||
extends_documentation_fragment: aws
|
||||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
Loading…
Reference in a new issue