updated to use shared region docs from ec2

This commit is contained in:
Brian Coca 2015-10-07 23:17:50 -04:00
parent 8d3122169d
commit 205115ea1f
21 changed files with 83 additions and 108 deletions

View file

@ -71,13 +71,9 @@ options:
- Write throughput capacity (units) to provision. - Write throughput capacity (units) to provision.
required: false required: false
default: 1 default: 1
region: extends_documentation_fragment:
description: - aws
- The AWS region to use. If not specified then the value of the EC2_REGION environment variable, if any, is used. - ec2
required: false
aliases: ['aws_region', 'ec2_region']
extends_documentation_fragment: aws
""" """
EXAMPLES = ''' EXAMPLES = '''

View file

@ -26,11 +26,6 @@ options:
description: description:
- the source region that AMI should be copied from - the source region that AMI should be copied from
required: true 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: source_image_id:
description: description:
- the id of the image in source region that should be copied - the id of the image in source region that should be copied
@ -63,7 +58,9 @@ options:
default: null default: null
author: Amir Moulavi <amir.moulavi@gmail.com> author: Amir Moulavi <amir.moulavi@gmail.com>
extends_documentation_fragment: aws extends_documentation_fragment:
- aws
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -28,7 +28,9 @@ options:
required: false required: false
default: null default: null
aliases: ['elb_ids', 'ec2_elbs'] aliases: ['elb_ids', 'ec2_elbs']
extends_documentation_fragment: aws extends_documentation_fragment:
- aws
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -74,8 +74,10 @@ options:
source_dest_check: source_dest_check:
description: 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. - 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 required: false
extends_documentation_fragment: aws extends_documentation_fragment:
- aws
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -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. - The ID of the ENI. Pass this option to gather facts about a particular ENI, otherwise, all ENIs are returned.
required: false required: false
default: null default: null
extends_documentation_fragment: aws extends_documentation_fragment:
- aws
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -53,14 +55,14 @@ except ImportError:
def get_error_message(xml_string): def get_error_message(xml_string):
root = ET.fromstring(xml_string) root = ET.fromstring(xml_string)
for message in root.findall('.//Message'): for message in root.findall('.//Message'):
return message.text return message.text
def get_eni_info(interface): def get_eni_info(interface):
interface_info = {'id': interface.id, interface_info = {'id': interface.id,
'subnet_id': interface.subnet_id, 'subnet_id': interface.subnet_id,
'vpc_id': interface.vpc_id, 'vpc_id': interface.vpc_id,
@ -72,7 +74,7 @@ def get_eni_info(interface):
'source_dest_check': interface.source_dest_check, 'source_dest_check': interface.source_dest_check,
'groups': dict((group.id, group.name) for group in interface.groups), 'groups': dict((group.id, group.name) for group in interface.groups),
} }
if interface.attachment is not None: if interface.attachment is not None:
interface_info['attachment'] = {'attachment_id': interface.attachment.id, interface_info['attachment'] = {'attachment_id': interface.attachment.id,
'instance_id': interface.attachment.instance_id, 'instance_id': interface.attachment.instance_id,
@ -81,23 +83,23 @@ def get_eni_info(interface):
'attach_time': interface.attachment.attach_time, 'attach_time': interface.attachment.attach_time,
'delete_on_termination': interface.attachment.delete_on_termination, 'delete_on_termination': interface.attachment.delete_on_termination,
} }
return interface_info return interface_info
def list_eni(connection, module): def list_eni(connection, module):
eni_id = module.params.get("eni_id") eni_id = module.params.get("eni_id")
interface_dict_array = [] interface_dict_array = []
try: try:
all_eni = connection.get_all_network_interfaces(eni_id) all_eni = connection.get_all_network_interfaces(eni_id)
except BotoServerError as e: except BotoServerError as e:
module.fail_json(msg=get_error_message(e.args[2])) module.fail_json(msg=get_error_message(e.args[2]))
for interface in all_eni: for interface in all_eni:
interface_dict_array.append(get_eni_info(interface)) interface_dict_array.append(get_eni_info(interface))
module.exit_json(interfaces=interface_dict_array) module.exit_json(interfaces=interface_dict_array)
@ -108,14 +110,14 @@ def main():
eni_id = dict(default=None) eni_id = dict(default=None)
) )
) )
module = AnsibleModule(argument_spec=argument_spec) module = AnsibleModule(argument_spec=argument_spec)
if not HAS_BOTO: if not HAS_BOTO:
module.fail_json(msg='boto required for this module') module.fail_json(msg='boto required for this module')
region, ec2_url, aws_connect_params = get_aws_connection_info(module) region, ec2_url, aws_connect_params = get_aws_connection_info(module)
if region: if region:
try: try:
connection = connect_to_aws(boto.ec2, region, **aws_connect_params) connection = connect_to_aws(boto.ec2, region, **aws_connect_params)
@ -125,11 +127,8 @@ def main():
module.fail_json(msg="region must be specified") module.fail_json(msg="region must be specified")
list_eni(connection, module) list_eni(connection, module)
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
from ansible.module_utils.ec2 import * from ansible.module_utils.ec2 import *
# this is magic, see lib/ansible/module_common.py
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
main() main()

View file

@ -27,19 +27,15 @@ options:
- The VPC ID for the VPC in which to manage the Internet Gateway. - The VPC ID for the VPC in which to manage the Internet Gateway.
required: true required: true
default: null 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: state:
description: description:
- Create or terminate the IGW - Create or terminate the IGW
required: false required: false
default: present default: present
choices: [ 'present', 'absent' ] choices: [ 'present', 'absent' ]
extends_documentation_fragment: aws extends_documentation_fragment:
- aws
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -61,8 +61,9 @@ options:
description: description:
- "VPC ID of the VPC in which to create the route table." - "VPC ID of the VPC in which to create the route table."
required: true required: true
extends_documentation_fragment:
extends_documentation_fragment: aws - aws
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -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. - 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 required: false
default: null default: null
region: extends_documentation_fragment:
description: - aws
- 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) - ec2
required: false
default: null
aliases: [ 'aws_region', 'ec2_region' ]
extends_documentation_fragment: aws
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -49,8 +49,9 @@ options:
- "VPC ID of the VPC in which to create the subnet." - "VPC ID of the VPC in which to create the subnet."
required: false required: false
default: null default: null
extends_documentation_fragment:
extends_documentation_fragment: aws - aws
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -230,14 +231,14 @@ def main():
vpc_id = dict(default=None, required=True) vpc_id = dict(default=None, required=True)
) )
) )
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
if not HAS_BOTO: if not HAS_BOTO:
module.fail_json(msg='boto is required for this module') module.fail_json(msg='boto is required for this module')
region, ec2_url, aws_connect_params = get_aws_connection_info(module) region, ec2_url, aws_connect_params = get_aws_connection_info(module)
if region: if region:
try: try:
connection = connect_to_aws(boto.vpc, region, **aws_connect_params) connection = connect_to_aws(boto.vpc, region, **aws_connect_params)
@ -269,4 +270,4 @@ from ansible.module_utils.ec2 import * # noqa
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -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. - 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 required: false
default: null default: null
region: extends_documentation_fragment:
description: - aws
- 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) - ec2
required: false
default: null
aliases: [ 'aws_region', 'ec2_region' ]
extends_documentation_fragment: aws
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -127,4 +122,4 @@ from ansible.module_utils.basic import *
from ansible.module_utils.ec2 import * from ansible.module_utils.ec2 import *
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -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. - 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 required: false
default: null 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: wait:
version_added: "2.0" version_added: "2.0"
description: description:
@ -56,7 +50,9 @@ options:
required: false required: false
default: 120 default: 120
extends_documentation_fragment: aws extends_documentation_fragment:
- aws
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -44,6 +44,8 @@ options:
description: description:
- The number of times to wait for the cluster to have an instance - The number of times to wait for the cluster to have an instance
required: false required: false
extends_documentation_fragment:
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -56,6 +56,8 @@ options:
description: description:
- A value showing who or what started the task (for informational purposes) - A value showing who or what started the task (for informational purposes)
required: False required: False
extends_documentation_fragment:
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -52,7 +52,8 @@ options:
- A list of names of volumes to be attached - A list of names of volumes to be attached
required: False required: False
type: list of name type: list of name
extends_documentation_fragment:
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -89,7 +89,9 @@ options:
default: 3 default: 3
choices: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] choices: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
author: "zimbatm (@zimbatm)" author: "zimbatm (@zimbatm)"
extends_documentation_fragment: aws extends_documentation_fragment:
- aws
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -46,7 +46,9 @@ options:
- Comment associated with the zone - Comment associated with the zone
required: false required: false
default: '' default: ''
extends_documentation_fragment: aws extends_documentation_fragment:
- aws
- ec2
author: "Christopher Troup (@minichate)" author: "Christopher Troup (@minichate)"
''' '''

View file

@ -38,11 +38,6 @@ options:
- The JSON policy as a string. - The JSON policy as a string.
required: false required: false
default: null 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: s3_url:
description: description:
- S3 URL endpoint for usage with Eucalypus, fakes3, etc. Otherwise assumes AWS - S3 URL endpoint for usage with Eucalypus, fakes3, etc. Otherwise assumes AWS
@ -71,8 +66,9 @@ options:
required: false required: false
default: no default: no
choices: [ 'yes', 'no' ] choices: [ 'yes', 'no' ]
extends_documentation_fragment:
extends_documentation_fragment: aws - aws
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -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." - "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 required: false
default: null 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: rule_id:
description: 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." - "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." - "Indicates when, in days, an object transitions to a different storage class. If transition_date is not specified, this parameter is required."
required: false required: false
default: null default: null
extends_documentation_fragment:
extends_documentation_fragment: aws - aws
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -26,11 +26,6 @@ options:
description: description:
- "Name of the s3 bucket." - "Name of the s3 bucket."
required: true 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: state:
description: description:
- "Enable or disable logging." - "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." - "The prefix that should be prepended to the generated log files written to the target_bucket."
required: false required: false
default: "" default: ""
extends_documentation_fragment:
extends_documentation_fragment: aws - aws
- ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -181,4 +177,4 @@ from ansible.module_utils.basic import *
from ansible.module_utils.ec2 import * from ansible.module_utils.ec2 import *
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -61,13 +61,9 @@ options:
- The receive message wait time in seconds. - The receive message wait time in seconds.
required: false required: false
default: null default: null
region: extends_documentation_fragment:
description: - aws
- The AWS region to use. If not specified then the value of the EC2_REGION environment variable, if any, is used. - ec2
required: false
aliases: ['aws_region', 'ec2_region']
extends_documentation_fragment: aws
""" """
EXAMPLES = ''' EXAMPLES = '''

View file

@ -58,7 +58,9 @@ options:
default: null default: null
notes: notes:
- In order to use the assumed role in a following playbook task you must pass the access_key, access_secret and access_token - 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 = ''' EXAMPLES = '''