diff --git a/changelogs/fragments/64230-deprecate-unused.yml b/changelogs/fragments/64230-deprecate-unused.yml new file mode 100644 index 00000000000..050b9370ede --- /dev/null +++ b/changelogs/fragments/64230-deprecate-unused.yml @@ -0,0 +1,5 @@ +deprecated_features: +- "ec2_eip - The ``wait_timeout`` option had no effect and will be removed in Ansible 2.14" +- "ec2_key - The ``wait`` option had no effect and will be removed in Ansible 2.14" +- "ec2_key - The ``wait_timeout`` option had no effect and will be removed in Ansible 2.14" +- "ec2_lc - The ``associate_public_ip_address`` option had no effect and will be removed in Ansible 2.14" diff --git a/docs/docsite/rst/porting_guides/porting_guide_2.10.rst b/docs/docsite/rst/porting_guides/porting_guide_2.10.rst index 4a18459c254..338d5f81a75 100644 --- a/docs/docsite/rst/porting_guides/porting_guide_2.10.rst +++ b/docs/docsite/rst/porting_guides/porting_guide_2.10.rst @@ -59,7 +59,10 @@ The following functionality will be removed in Ansible 2.14. Please update updat * The return values ``err`` and ``out`` of :ref:`docker_stack ` have been deprecated. Use ``stdout`` and ``stderr`` from now on instead. * :ref:`cloudformation `: the ``template_format`` option will be removed. It has been ignored by the module since Ansible 2.3. * :ref:`data_pipeline `: the ``version`` option will be removed. It has always been ignored by the module. - +* :ref:`ec2_eip `: the ``wait_timeout`` option will be removed. It has had no effect since Ansible 2.3. +* :ref:`ec2_key `: the ``wait`` option will be removed. It has had no effect since Ansible 2.5. +* :ref:`ec2_key `: the ``wait_timeout`` option will be removed. It has had no effect since Ansible 2.5. +* :ref:`ec2_lc `: the ``associate_public_ip_address`` option will be removed. It has always been ignored by the module. The following functionality will change in Ansible 2.14. Please update update your playbooks accordingly. diff --git a/lib/ansible/modules/cloud/amazon/ec2.py b/lib/ansible/modules/cloud/amazon/ec2.py index f17e825ecfe..c4b29d9573e 100644 --- a/lib/ansible/modules/cloud/amazon/ec2.py +++ b/lib/ansible/modules/cloud/amazon/ec2.py @@ -1,18 +1,9 @@ #!/usr/bin/python # This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], @@ -69,6 +60,7 @@ options: - Instance type to use for the instance, see U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html). required: true type: str + aliases: ['type'] tenancy: version_added: "1.9" description: @@ -228,6 +220,7 @@ options: - Used with 'exact_count' to determine how many nodes based on a specific tag criteria should be running. This can be expressed in multiple ways and is shown in the EXAMPLES section. For instance, one can request 25 servers that are tagged with "class=webserver". The specified tag must already exist or be passed in as the 'instance_tags' option. + type: raw network_interfaces: version_added: "2.0" description: diff --git a/lib/ansible/modules/cloud/amazon/ec2_ami.py b/lib/ansible/modules/cloud/amazon/ec2_ami.py index d2f18fe883c..d1a04899945 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_ami.py +++ b/lib/ansible/modules/cloud/amazon/ec2_ami.py @@ -21,25 +21,33 @@ options: instance_id: description: - Instance ID to create the AMI from. + type: str name: description: - The name of the new AMI. + type: str architecture: version_added: "2.3" description: - The target architecture of the image to register + default: "x86_64" + type: str kernel_id: version_added: "2.3" description: - The target kernel id of the image to register. + type: str virtualization_type: version_added: "2.3" description: - The virtualization type of the image to register. + default: "hvm" + type: str root_device_name: version_added: "2.3" description: - The root device name of the image to register. + type: str wait: description: - Wait for the AMI to be in state 'available' before returning. @@ -49,14 +57,17 @@ options: description: - How long before wait gives up, in seconds. default: 900 + type: int state: description: - Register or deregister an AMI. default: 'present' choices: [ "absent", "present" ] + type: str description: description: - Human-readable string describing the contents and purpose of the AMI. + type: str no_reboot: description: - Flag indicating that the bundling process should not attempt to shutdown the instance before bundling. If this flag is True, the @@ -66,13 +77,39 @@ options: image_id: description: - Image ID to be deregistered. + type: str device_mapping: version_added: "2.0" description: - List of device hashes/dictionaries with custom configurations (same block-device-mapping parameters). - - > - Valid properties include: device_name, volume_type, size/volume_size (in GiB), delete_on_termination (boolean), no_device (boolean), - snapshot_id, iops (for io1 volume_type), encrypted + type: list + elements: dict + suboptions: + device_name: + type: str + description: The device name. For example C(/dev/sda). + volume_type: + type: str + description: The volume type. Defaults to C(gp2) when not set. + delete_on_termination: + type: bool + description: Whether the device should be automatically deleted when the Instance is terminated. + no_device: + type: bool + description: Suppresses the specified device included in the block device mapping of the AMI. + snapshot_id: + type: str + description: The ID of the Snapshot. + iops: + type: int + description: When using an C(io1) I(volume_type) this sets the number of IOPS provisioned for the volume + encrypted: + type: bool + description: Whether the volume should be encrypted. + volume_size: + aliases: ['size'] + type: int + description: The size of the volume (in GiB) delete_snapshot: description: - Delete snapshots when deregistering the AMI. @@ -82,6 +119,7 @@ options: description: - A dictionary of tags to add to the new image; '{"key":"value"}' and '{"key":"value","key":"value"}' version_added: "2.0" + type: dict purge_tags: description: Whether to remove existing tags that aren't passed in the C(tags) parameter version_added: "2.5" @@ -93,10 +131,12 @@ options: be a list of account ids. group_name should be a list of groups, "all" is the only acceptable value currently. - You must pass all desired launch permissions if you wish to modify existing launch permissions (passing just groups will remove all users) version_added: "2.0" + type: dict image_location: description: - The s3 location of an image to use for the AMI. version_added: "2.5" + type: str enhanced_networking: description: - A boolean representing whether enhanced networking with ENA is enabled or not. @@ -106,14 +146,18 @@ options: description: - A list of valid billing codes. To be used with valid accounts by aws marketplace vendors. version_added: "2.5" + type: list + elements: str ramdisk_id: description: - The ID of the RAM disk. version_added: "2.5" + type: str sriov_net_support: description: - Set to simple to enable enhanced networking with the Intel 82599 Virtual Function interface for the AMI and any instances that you launch from the AMI. version_added: "2.5" + type: str author: - "Evan Duffield (@scicoin-project) " - "Constantin Bugneac (@Constantin07) " diff --git a/lib/ansible/modules/cloud/amazon/ec2_ami_copy.py b/lib/ansible/modules/cloud/amazon/ec2_ami_copy.py index d7e7673520b..07a65eb25de 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_ami_copy.py +++ b/lib/ansible/modules/cloud/amazon/ec2_ami_copy.py @@ -1,19 +1,10 @@ #!/usr/bin/python # -*- coding: utf-8 -*- # This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], @@ -32,17 +23,21 @@ options: description: - The source region the AMI should be copied from. required: true + type: str source_image_id: description: - The ID of the AMI in source region that should be copied. required: true + type: str name: description: - The name of the new AMI to copy. (As of 2.3 the default is 'default', in prior versions it was 'null'.) default: "default" + type: str description: description: - An optional human-readable string describing the contents and purpose of the new AMI. + type: str encrypted: description: - Whether or not the destination snapshots of the copied AMI should be encrypted. @@ -50,8 +45,9 @@ options: type: bool kms_key_id: description: - - KMS key id used to encrypt image. If not specified, uses default EBS Customer Master Key (CMK) for your account. + - KMS key id used to encrypt the image. If not specified, uses default EBS Customer Master Key (CMK) for your account. version_added: "2.2" + type: str wait: description: - Wait for the copied AMI to be in state 'available' before returning. @@ -63,9 +59,11 @@ options: - From 2.3-2.5 this option was deprecated in favor of boto3 waiter defaults. This was reenabled in 2.6 to allow timeouts greater than 10 minutes. default: 600 + type: int tags: description: - A hash/dictionary of tags to add to the new copied AMI; '{"key":"value"}' and '{"key":"value","key":"value"}' + type: dict tag_equality: description: - Whether to use tags if the source AMI already exists in the target region. If this is set, and all tags match diff --git a/lib/ansible/modules/cloud/amazon/ec2_ami_info.py b/lib/ansible/modules/cloud/amazon/ec2_ami_info.py index b03cb5e8142..762354249ea 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_ami_info.py +++ b/lib/ansible/modules/cloud/amazon/ec2_ami_info.py @@ -2,6 +2,8 @@ # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], @@ -23,20 +25,27 @@ options: image_ids: description: One or more image IDs. aliases: [image_id] + type: list + elements: str filters: description: - A dict of filters to apply. Each dict item consists of a filter key and a filter value. - See U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeImages.html) for possible filters. - Filter names and values are case sensitive. + type: dict owners: description: - Filter the images by the owner. Valid options are an AWS account ID, self, - or an AWS owner alias ( amazon | aws-marketplace | microsoft ). aliases: [owner] + type: list + elements: str executable_users: description: - Filter images by users with explicit launch permissions. Valid options are an AWS account ID, self, or all (public AMIs). aliases: [executable_user] + type: list + elements: str describe_image_attributes: description: - Describe attributes (like launchPermission) of the images found. @@ -79,17 +88,17 @@ images: type: complex contains: architecture: - description: The architecture of the image + description: The architecture of the image. returned: always type: str sample: x86_64 block_device_mappings: - description: Any block device mapping entries + description: Any block device mapping entries. returned: always type: complex contains: device_name: - description: The device name exposed to the instance + description: The device name exposed to the instance. returned: always type: str sample: /dev/sda1 @@ -98,86 +107,94 @@ images: returned: always type: complex creation_date: - description: The date and time the image was created + description: The date and time the image was created. returned: always type: str sample: '2017-10-16T19:22:13.000Z' description: - description: The description of the AMI + description: The description of the AMI. returned: always type: str sample: '' ena_support: - description: whether enhanced networking with ENA is enabled + description: Whether enhanced networking with ENA is enabled. returned: always type: bool sample: true hypervisor: - description: The hypervisor type of the image + description: The hypervisor type of the image. returned: always type: str sample: xen image_id: - description: The ID of the AMI + description: The ID of the AMI. returned: always type: str sample: ami-5b466623 image_location: - description: The location of the AMI + description: The location of the AMI. returned: always type: str sample: 408466080000/Webapp image_type: - description: The type of image + description: The type of image. returned: always type: str sample: machine launch_permissions: - description: launch permissions of the ami - returned: when image is owned by calling account and describe_image_attributes is yes - type: complex + description: A List of AWS accounts may launch the AMI. + returned: When image is owned by calling account and I(describe_image_attributes) is yes. + type: list + elements: dict + contains: + group: + description: A value of 'all' means the AMI is public. + type: str + user_id: + description: An AWS account ID with permissions to launch the AMI. + type: str sample: [{"group": "all"}, {"user_id": "408466080000"}] name: - description: The name of the AMI that was provided during image creation + description: The name of the AMI that was provided during image creation. returned: always type: str sample: Webapp owner_id: - description: The AWS account ID of the image owner + description: The AWS account ID of the image owner. returned: always type: str sample: '408466080000' public: - description: whether the image has public launch permissions + description: Whether the image has public launch permissions. returned: always type: bool sample: true root_device_name: - description: The device name of the root device + description: The device name of the root device. returned: always type: str sample: /dev/sda1 root_device_type: - description: The type of root device used by the AMI + description: The type of root device used by the AMI. returned: always type: str sample: ebs sriov_net_support: - description: whether enhanced networking is enabled + description: Whether enhanced networking is enabled. returned: always type: str sample: simple state: - description: The current state of the AMI + description: The current state of the AMI. returned: always type: str sample: available tags: - description: Any tags assigned to the image + description: Any tags assigned to the image. returned: always - type: complex + type: dict virtualization_type: - description: The type of virtualization of the AMI + description: The type of virtualization of the AMI. returned: always type: str sample: hvm diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg.py b/lib/ansible/modules/cloud/amazon/ec2_asg.py index 9d55795fd0a..6fce5638e1a 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_asg.py +++ b/lib/ansible/modules/cloud/amazon/ec2_asg.py @@ -1,18 +1,10 @@ #!/usr/bin/python # This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], 'supported_by': 'community'} @@ -21,110 +13,139 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', DOCUMENTATION = """ --- module: ec2_asg -short_description: Create or delete AWS Autoscaling Groups +short_description: Create or delete AWS AutoScaling Groups (ASGs) description: - - Can create or delete AWS Autoscaling Groups - - Can be used with the ec2_lc module to manage Launch Configurations + - Can create or delete AWS AutoScaling Groups. + - Can be used with the M(ec2_lc) module to manage Launch Configurations. version_added: "1.6" author: "Gareth Rushgrove (@garethr)" requirements: [ "boto3", "botocore" ] options: state: description: - - register or deregister the instance + - Register or deregister the instance. choices: ['present', 'absent'] default: present + type: str name: description: - - Unique name for group to be created or deleted + - Unique name for group to be created or deleted. required: true + type: str load_balancers: description: - List of ELB names to use for the group. Use for classic load balancers. + type: list + elements: str target_group_arns: description: - List of target group ARNs to use for the group. Use for application load balancers. version_added: "2.4" + type: list + elements: str availability_zones: description: - - List of availability zone names in which to create the group. Defaults to all the availability zones in the region if vpc_zone_identifier is not set. + - List of availability zone names in which to create the group. + - Defaults to all the availability zones in the region if I(vpc_zone_identifier) is not set. + type: list + elements: str launch_config_name: description: - - Name of the Launch configuration to use for the group. See the ec2_lc module for managing these. - If unspecified then the current group value will be used. One of launch_config_name or launch_template must be provided. + - Name of the Launch configuration to use for the group. See the M(ec2_lc) module for managing these. + - If unspecified then the current group value will be used. One of I(launch_config_name) or I(launch_template) must be provided. + type: str launch_template: description: - Dictionary describing the Launch Template to use suboptions: version: description: - - The version number of the launch template to use. Defaults to latest version if not provided. - default: "latest" + - The version number of the launch template to use. + - Defaults to latest version if not provided. + type: str launch_template_name: description: - - The name of the launch template. Only one of launch_template_name or launch_template_id is required. + - The name of the launch template. Only one of I(launch_template_name) or I(launch_template_id) is required. + type: str launch_template_id: description: - - The id of the launch template. Only one of launch_template_name or launch_template_id is required. + - The id of the launch template. Only one of I(launch_template_name) or I(launch_template_id) is required. + type: str + type: dict version_added: "2.8" min_size: description: - Minimum number of instances in group, if unspecified then the current group value will be used. + type: int max_size: description: - Maximum number of instances in group, if unspecified then the current group value will be used. + type: int placement_group: description: - Physical location of your cluster placement group created in Amazon EC2. version_added: "2.3" + type: str desired_capacity: description: - Desired number of instances in group, if unspecified then the current group value will be used. + type: int replace_all_instances: description: - In a rolling fashion, replace all instances that used the old launch configuration with one from the new launch configuration. - It increases the ASG size by C(replace_batch_size), waits for the new instances to be up and running. + It increases the ASG size by I(replace_batch_size), waits for the new instances to be up and running. After that, it terminates a batch of old instances, waits for the replacements, and repeats, until all old instances are replaced. Once that's done the ASG size is reduced back to the expected size. version_added: "1.8" - default: 'no' + default: false type: bool replace_batch_size: description: - - Number of instances you'd like to replace at a time. Used with replace_all_instances. + - Number of instances you'd like to replace at a time. Used with I(replace_all_instances). required: false version_added: "1.8" default: 1 + type: int replace_instances: description: - - List of instance_ids belonging to the named ASG that you would like to terminate and be replaced with instances matching the current launch - configuration. + - List of I(instance_ids) belonging to the named AutoScalingGroup that you would like to terminate and be replaced with instances + matching the current launch configuration. version_added: "1.8" + type: list + elements: str lc_check: description: - - Check to make sure instances that are being replaced with replace_instances do not already have the current launch_config. + - Check to make sure instances that are being replaced with I(replace_instances) do not already have the current I(launch_config). version_added: "1.8" - default: 'yes' + default: true type: bool lt_check: description: - - Check to make sure instances that are being replaced with replace_instances do not already have the current launch_template or launch_template version. + - Check to make sure instances that are being replaced with I(replace_instances) do not already have the current + I(launch_template or I(launch_template) I(version). version_added: "2.8" - default: 'yes' + default: true type: bool vpc_zone_identifier: description: - List of VPC subnets to use + type: list + elements: str tags: description: - - A list of tags to add to the Auto Scale Group. Optional key is 'propagate_at_launch', which defaults to true. + - A list of tags to add to the Auto Scale Group. + - Optional key is I(propagate_at_launch), which defaults to true. + - When I(propagate_at_launch) is true the tags will be propagated to the Instances created. version_added: "1.7" + type: list + elements: dict health_check_period: description: - Length of time in seconds after a new EC2 instance comes into service that Auto Scaling starts checking its health. required: false - default: 300 seconds + default: 300 version_added: "1.7" + type: int health_check_type: description: - The service you want the health status from, Amazon EC2 or Elastic Load Balancer. @@ -132,76 +153,94 @@ options: default: EC2 version_added: "1.7" choices: ['EC2', 'ELB'] + type: str default_cooldown: description: - The number of seconds after a scaling activity completes before another can begin. - default: 300 seconds + default: 300 version_added: "2.0" + type: int wait_timeout: description: - How long to wait for instances to become viable when replaced. If you experience the error "Waited too long for ELB instances to be healthy", try increasing this value. default: 300 + type: int version_added: "1.8" wait_for_instances: description: - Wait for the ASG instances to be in a ready state before exiting. If instances are behind an ELB, it will wait until the ELB determines all instances have a lifecycle_state of "InService" and a health_status of "Healthy". version_added: "1.9" - default: 'yes' + default: true type: bool termination_policies: description: - An ordered list of criteria used for selecting instances to be removed from the Auto Scaling group when reducing capacity. - - For 'Default', when used to create a new autoscaling group, the "Default"i value is used. When used to change an existent autoscaling group, the - current termination policies are maintained. + - Using I(termination_policies=Default) when modifying an existing AutoScalingGroup will result in the existing policy being retained + instead of changed to C(Default). + - 'Valid values include: C(Default), C(OldestInstance), C(NewestInstance), C(OldestLaunchConfiguration), C(ClosestToNextInstanceHour)' + - 'Full documentation of valid values can be found in the AWS documentation:' + - 'U(https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html#custom-termination-policy)' default: Default - choices: ['OldestInstance', 'NewestInstance', 'OldestLaunchConfiguration', 'ClosestToNextInstanceHour', 'Default'] version_added: "2.0" + type: list + elements: str notification_topic: description: - A SNS topic ARN to send auto scaling notifications to. version_added: "2.2" + type: str notification_types: description: - A list of auto scaling events to trigger notifications on. default: - - 'autoscaling:EC2_INSTANCE_LAUNCH' - - 'autoscaling:EC2_INSTANCE_LAUNCH_ERROR' - - 'autoscaling:EC2_INSTANCE_TERMINATE' - - 'autoscaling:EC2_INSTANCE_TERMINATE_ERROR' + - 'autoscaling:EC2_INSTANCE_LAUNCH' + - 'autoscaling:EC2_INSTANCE_LAUNCH_ERROR' + - 'autoscaling:EC2_INSTANCE_TERMINATE' + - 'autoscaling:EC2_INSTANCE_TERMINATE_ERROR' required: false version_added: "2.2" + type: list + elements: str suspend_processes: description: - A list of scaling processes to suspend. + - 'Valid values include:' + - C(Launch), C(Terminate), C(HealthCheck), C(ReplaceUnhealthy), C(AZRebalance), C(AlarmNotification), C(ScheduledActions), C(AddToLoadBalancer) + - 'Full documentation of valid values can be found in the AWS documentation:' + - 'U(https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html)' default: [] - choices: ['Launch', 'Terminate', 'HealthCheck', 'ReplaceUnhealthy', 'AZRebalance', 'AlarmNotification', 'ScheduledActions', 'AddToLoadBalancer'] version_added: "2.3" + type: list + elements: str metrics_collection: description: - - Enable ASG metrics collection + - Enable ASG metrics collection. type: bool - default: 'no' + default: false version_added: "2.6" metrics_granularity: description: - - When metrics_collection is enabled this will determine granularity of metrics collected by CloudWatch - default: "1minute" + - When I(metrics_collection=true) this will determine the granularity of metrics collected by CloudWatch. + default: "1Minute" version_added: "2.6" + type: str metrics_list: description: - - List of autoscaling metrics to collect when enabling metrics_collection + - List of autoscaling metrics to collect when I(metrics_collection=true). default: - - 'GroupMinSize' - - 'GroupMaxSize' - - 'GroupDesiredCapacity' - - 'GroupInServiceInstances' - - 'GroupPendingInstances' - - 'GroupStandbyInstances' - - 'GroupTerminatingInstances' - - 'GroupTotalInstances' + - 'GroupMinSize' + - 'GroupMaxSize' + - 'GroupDesiredCapacity' + - 'GroupInServiceInstances' + - 'GroupPendingInstances' + - 'GroupStandbyInstances' + - 'GroupTerminatingInstances' + - 'GroupTotalInstances' version_added: "2.6" + type: list + elements: str extends_documentation_fragment: - aws - ec2 diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg_info.py b/lib/ansible/modules/cloud/amazon/ec2_asg_info.py index 71847f08086..217222dc1b5 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_asg_info.py +++ b/lib/ansible/modules/cloud/amazon/ec2_asg_info.py @@ -26,6 +26,7 @@ options: description: - The prefix or name of the auto scaling group(s) you are searching for. - "Note: This is a regular expression match with implicit '^' (beginning of string). Append '$' for a complete name match." + type: str required: false tags: description: @@ -33,6 +34,7 @@ options: A dictionary/hash of tags in the format { tag1_name: 'tag1_value', tag2_name: 'tag2_value' } to match against the auto scaling group(s) you are searching for. required: false + type: dict extends_documentation_fragment: - aws - ec2 diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg_lifecycle_hook.py b/lib/ansible/modules/cloud/amazon/ec2_asg_lifecycle_hook.py index c23fe752046..0999d16c8b0 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_asg_lifecycle_hook.py +++ b/lib/ansible/modules/cloud/amazon/ec2_asg_lifecycle_hook.py @@ -3,6 +3,9 @@ # Copyright: (c) 2017, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'metadata_version': '1.1'} @@ -24,23 +27,28 @@ options: required: false choices: ['present', 'absent'] default: present + type: str lifecycle_hook_name: description: - The name of the lifecycle hook. required: true + type: str autoscaling_group_name: description: - The name of the Auto Scaling group to which you want to assign the lifecycle hook. required: true + type: str transition: description: - The instance state to which you want to attach the lifecycle hook. required: true choices: ['autoscaling:EC2_INSTANCE_TERMINATING', 'autoscaling:EC2_INSTANCE_LAUNCHING'] + type: str role_arn: description: - The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. required: false + type: str notification_target_arn: description: - The ARN of the notification target that Auto Scaling will use to notify you when an @@ -48,17 +56,20 @@ options: This target can be either an SQS queue or an SNS topic. If you specify an empty string, this overrides the current ARN. required: false + type: str notification_meta_data: description: - Contains additional information that you want to include any time Auto Scaling sends a message to the notification target. required: false + type: str heartbeat_timeout: description: - The amount of time, in seconds, that can elapse before the lifecycle hook times out. When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat. + - By default amazon will use 3600 (1 hour) required: false - default: 3600 (1 hour) + type: int default_result: description: - Defines the action the Auto Scaling group should take when the lifecycle hook timeout @@ -66,6 +77,7 @@ options: required: false choices: ['ABANDON', 'CONTINUE'] default: ABANDON + type: str extends_documentation_fragment: - aws - ec2 diff --git a/lib/ansible/modules/cloud/amazon/ec2_customer_gateway.py b/lib/ansible/modules/cloud/amazon/ec2_customer_gateway.py index c578cd783c0..db62b76c2ad 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_customer_gateway.py +++ b/lib/ansible/modules/cloud/amazon/ec2_customer_gateway.py @@ -1,17 +1,9 @@ #!/usr/bin/python # -# This is a free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This Ansible library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this library. If not, see . +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], @@ -23,7 +15,7 @@ DOCUMENTATION = ''' module: ec2_customer_gateway short_description: Manage an AWS customer gateway description: - - Manage an AWS customer gateway + - Manage an AWS customer gateway. version_added: "2.2" author: Michael Baydoun (@MichaelBaydoun) requirements: [ botocore, boto3 ] @@ -36,26 +28,31 @@ notes: options: bgp_asn: description: - - Border Gateway Protocol (BGP) Autonomous System Number (ASN), required when state=present. + - Border Gateway Protocol (BGP) Autonomous System Number (ASN), required when I(state=present). + type: int ip_address: description: - Internet-routable IP address for customers gateway, must be a static address. required: true + type: str name: description: - Name of the customer gateway. required: true + type: str routing: description: - The type of routing. choices: ['static', 'dynamic'] default: dynamic version_added: '2.4' + type: str state: description: - Create or terminate the Customer Gateway. default: present choices: [ 'present', 'absent' ] + type: str extends_documentation_fragment: - aws - ec2 @@ -104,13 +101,12 @@ gateway.customer_gateways: state: description: state of gateway. returned: when gateway exists and is available. - state: available + sample: available type: str tags: - description: any tags on the gateway. + description: Any tags on the gateway. returned: when gateway exists and is available, and when tags exist. - state: available - type: str + type: list type: description: encryption type. returned: when gateway exists and is available. diff --git a/lib/ansible/modules/cloud/amazon/ec2_customer_gateway_info.py b/lib/ansible/modules/cloud/amazon/ec2_customer_gateway_info.py index 8223ca1bc1c..566a7c93256 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_customer_gateway_info.py +++ b/lib/ansible/modules/cloud/amazon/ec2_customer_gateway_info.py @@ -2,6 +2,9 @@ # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'metadata_version': '1.1'} @@ -21,9 +24,12 @@ options: description: - A dict of filters to apply. Each dict item consists of a filter key and a filter value. See U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeCustomerGateways.html) for possible filters. + type: dict customer_gateway_ids: description: - Get details of a specific customer gateways using customer gateway ID/IDs. This value should be provided as a list. + type: list + elements: str extends_documentation_fragment: - aws - ec2 diff --git a/lib/ansible/modules/cloud/amazon/ec2_eip.py b/lib/ansible/modules/cloud/amazon/ec2_eip.py index 42aafe40546..c8b063ca793 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_eip.py +++ b/lib/ansible/modules/cloud/amazon/ec2_eip.py @@ -28,65 +28,73 @@ options: required: false aliases: [ instance_id ] version_added: "2.0" + type: str public_ip: description: - The IP address of a previously allocated EIP. - - If present and device is specified, the EIP is associated with the device. - - If absent and device is specified, the EIP is disassociated from the device. + - If C(present) and device is specified, the EIP is associated with the device. + - If C(absent) and device is specified, the EIP is disassociated from the device. aliases: [ ip ] + type: str state: description: - - If present, allocate an EIP or associate an existing EIP with a device. - - If absent, disassociate the EIP from the device and optionally release it. + - If C(present), allocate an EIP or associate an existing EIP with a device. + - If C(absent), disassociate the EIP from the device and optionally release it. choices: ['present', 'absent'] default: present + type: str in_vpc: description: - - Allocate an EIP inside a VPC or not. Required if specifying an ENI. - default: 'no' + - Allocate an EIP inside a VPC or not. Required if specifying an ENI with I(device_id). + default: false type: bool version_added: "1.4" reuse_existing_ip_allowed: description: - Reuse an EIP that is not associated to a device (when available), instead of allocating a new one. - default: 'no' + default: false type: bool version_added: "1.6" release_on_disassociation: description: - - whether or not to automatically release the EIP when it is disassociated - default: 'no' + - Whether or not to automatically release the EIP when it is disassociated. + default: false type: bool version_added: "2.0" private_ip_address: description: - The primary or secondary private IP address to associate with the Elastic IP address. version_added: "2.3" + type: str allow_reassociation: description: - Specify this option to allow an Elastic IP address that is already associated with another network interface or instance to be re-associated with the specified instance or interface. - default: 'no' + default: false type: bool version_added: "2.5" tag_name: description: - - When reuse_existing_ip_allowed is true, supplement with this option to only reuse - an Elastic IP if it is tagged with tag_name. - default: 'no' + - When I(reuse_existing_ip_allowed=true), supplement with this option to only reuse + an Elastic IP if it is tagged with I(tag_name). version_added: "2.9" + type: str tag_value: description: - - Supplements tag_name but also checks that the value of the tag provided in tag_name matches tag_value. - matches the tag_value - default: 'no' + - Supplements I(tag_name) but also checks that the value of the tag provided in I(tag_name) matches I(tag_value). + matches the I(tag_value) version_added: "2.9" + type: str public_ipv4_pool: description: - Allocates the new Elastic IP from the provided public IPv4 pool (BYOIP) only applies to newly allocated Elastic IPs, isn't validated when reuse_existing_ip_allowed is true. - default: 'no' version_added: "2.9" + type: str + wait_timeout: + description: + - The I(wait_timeout) option does nothing and will be removed in Ansible 2.14. + type: int extends_documentation_fragment: - aws - ec2 @@ -118,7 +126,7 @@ EXAMPLES = ''' ec2_eip: device_id: eni-c8ad70f3 public_ip: 93.184.216.119 - allow_reassociation: yes + allow_reassociation: true - name: disassociate an elastic IP from an instance ec2_eip: @@ -150,7 +158,7 @@ EXAMPLES = ''' keypair: mykey instance_type: c1.medium image: ami-40603AD1 - wait: yes + wait: true group: webserver count: 3 register: ec2 @@ -163,7 +171,7 @@ EXAMPLES = ''' - name: allocate a new elastic IP inside a VPC in us-west-2 ec2_eip: region: us-west-2 - in_vpc: yes + in_vpc: true register: eip - name: output the IP @@ -173,37 +181,37 @@ EXAMPLES = ''' - name: allocate eip - reuse unallocated ips (if found) with FREE tag ec2_eip: region: us-east-1 - in_vpc: yes - reuse_existing_ip_allowed: yes + in_vpc: true + reuse_existing_ip_allowed: true tag_name: FREE - name: allocate eip - reuse unallocted ips if tag reserved is nope ec2_eip: region: us-east-1 - in_vpc: yes - reuse_existing_ip_allowed: yes + in_vpc: true + reuse_existing_ip_allowed: true tag_name: reserved tag_value: nope - name: allocate new eip - from servers given ipv4 pool ec2_eip: region: us-east-1 - in_vpc: yes + in_vpc: true public_ipv4_pool: ipv4pool-ec2-0588c9b75a25d1a02 - name: allocate eip - from a given pool (if no free addresses where dev-servers tag is dynamic) ec2_eip: region: us-east-1 - in_vpc: yes - reuse_existing_ip_allowed: yes + in_vpc: true + reuse_existing_ip_allowed: true tag_name: dev-servers public_ipv4_pool: ipv4pool-ec2-0588c9b75a25d1a02 - name: allocate eip from pool - check if tag reserved_for exists and value is our hostname ec2_eip: region: us-east-1 - in_vpc: yes - reuse_existing_ip_allowed: yes + in_vpc: true + reuse_existing_ip_allowed: true tag_name: reserved_for tag_value: "{{ inventory_hostname }}" public_ipv4_pool: ipv4pool-ec2-0588c9b75a25d1a02 @@ -528,7 +536,7 @@ def main(): default=False), release_on_disassociation=dict(required=False, type='bool', default=False), allow_reassociation=dict(type='bool', default=False), - wait_timeout=dict(default=300, type='int'), + wait_timeout=dict(type='int', removed_in_version='2.14'), private_ip_address=dict(), tag_name=dict(), tag_value=dict(), diff --git a/lib/ansible/modules/cloud/amazon/ec2_eip_info.py b/lib/ansible/modules/cloud/amazon/ec2_eip_info.py index 7fc510629d7..27fda749031 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_eip_info.py +++ b/lib/ansible/modules/cloud/amazon/ec2_eip_info.py @@ -2,6 +2,9 @@ # Copyright (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} @@ -24,6 +27,7 @@ options: for possible filters. Filter names and values are case sensitive. required: false default: {} + type: dict extends_documentation_fragment: - aws - ec2 diff --git a/lib/ansible/modules/cloud/amazon/ec2_eni.py b/lib/ansible/modules/cloud/amazon/ec2_eni.py index 80dcbb7f922..8b6dbd1c328 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_eni.py +++ b/lib/ansible/modules/cloud/amazon/ec2_eni.py @@ -1,17 +1,9 @@ #!/usr/bin/python # -# This is a free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This Ansible library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this library. If not, see . +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], @@ -31,33 +23,43 @@ author: "Rob White (@wimnat)" options: eni_id: description: - - The ID of the ENI (to modify); if null and state is present, a new eni will be created. + - The ID of the ENI (to modify). + - If I(eni_id=None) and I(state=present), a new eni will be created. + type: str instance_id: description: - - Instance ID that you wish to attach ENI to. Since version 2.2, use the 'attached' parameter to attach or - detach an ENI. Prior to 2.2, to detach an ENI from an instance, use 'None'. + - Instance ID that you wish to attach ENI to. + - Since version 2.2, use the I(attached) parameter to attach or detach an ENI. Prior to 2.2, to detach an ENI from an instance, use C(None). + type: str private_ip_address: description: - Private IP address. + type: str subnet_id: description: - ID of subnet in which to create the ENI. + type: str description: description: - Optional description of the ENI. + type: str security_groups: description: - - List of security groups associated with the interface. Only used when state=present. Since version 2.2, you - can specify security groups by ID or by name or a combination of both. Prior to 2.2, you can specify only by ID. + - List of security groups associated with the interface. Only used when I(state=present). + - Since version 2.2, you can specify security groups by ID or by name or a combination of both. Prior to 2.2, you can specify only by ID. + type: list + elements: str state: description: - - Create or delete ENI + - Create or delete ENI. default: present choices: [ 'present', 'absent' ] + type: str device_index: description: - The index of the device for the network interface attachment on the instance. default: 0 + type: int attached: description: - Specifies if network interface should be attached or detached from instance. If omitted, attachment status @@ -66,9 +68,9 @@ options: type: bool force_detach: description: - - Force detachment of the interface. This applies either when explicitly detaching the interface by setting instance_id - to None or when deleting an interface with state=absent. - default: 'no' + - Force detachment of the interface. This applies either when explicitly detaching the interface by setting I(instance_id=None) + or when deleting an interface with I(state=absent). + default: false type: bool delete_on_termination: description: @@ -85,35 +87,38 @@ options: secondary_private_ip_addresses: description: - A list of IP addresses to assign as secondary IP addresses to the network interface. - This option is mutually exclusive of secondary_private_ip_address_count + This option is mutually exclusive of I(secondary_private_ip_address_count) required: false version_added: 2.2 + type: list + elements: str purge_secondary_private_ip_addresses: description: - To be used with I(secondary_private_ip_addresses) to determine whether or not to remove any secondary IP addresses other than those specified. - Set secondary_private_ip_addresses to an empty list to purge all secondary addresses. - default: no + - Set I(secondary_private_ip_addresses=[]) to purge all secondary addresses. + default: false type: bool version_added: 2.5 secondary_private_ip_address_count: description: - - The number of secondary IP addresses to assign to the network interface. This option is mutually exclusive of secondary_private_ip_addresses + - The number of secondary IP addresses to assign to the network interface. This option is mutually exclusive of I(secondary_private_ip_addresses) required: false version_added: 2.2 + type: int allow_reassignment: description: - Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface. required: false - default: 'no' + default: false type: bool version_added: 2.7 extends_documentation_fragment: - aws - ec2 notes: - - This module identifies and ENI based on either the eni_id, a combination of private_ip_address and subnet_id, - or a combination of instance_id and device_id. Any of these options will let you specify a particular ENI. + - This module identifies and ENI based on either the I(eni_id), a combination of I(private_ip_address) and I(subnet_id), + or a combination of I(instance_id) and I(device_id). Any of these options will let you specify a particular ENI. ''' EXAMPLES = ''' @@ -158,7 +163,7 @@ EXAMPLES = ''' # Destroy an ENI, detaching it from any instance if necessary - ec2_eni: eni_id: eni-xxxxxxx - force_detach: yes + force_detach: true state: absent # Update an ENI diff --git a/lib/ansible/modules/cloud/amazon/ec2_eni_info.py b/lib/ansible/modules/cloud/amazon/ec2_eni_info.py index 578a549bea5..99922a84d1d 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_eni_info.py +++ b/lib/ansible/modules/cloud/amazon/ec2_eni_info.py @@ -1,17 +1,9 @@ #!/usr/bin/python # -# This is a free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This Ansible library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this library. If not, see . +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], @@ -23,7 +15,7 @@ DOCUMENTATION = ''' module: ec2_eni_info short_description: Gather information about ec2 ENI interfaces in AWS description: - - Gather information about ec2 ENI interfaces in AWS + - Gather information about ec2 ENI interfaces in AWS. - This module was called C(ec2_eni_facts) before Ansible 2.9. The usage did not change. version_added: "2.0" author: "Rob White (@wimnat)" @@ -33,6 +25,7 @@ options: description: - A dict of filters to apply. Each dict item consists of a filter key and a filter value. See U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeNetworkInterfaces.html) for possible filters. + type: dict extends_documentation_fragment: - aws - ec2 diff --git a/lib/ansible/modules/cloud/amazon/ec2_group.py b/lib/ansible/modules/cloud/amazon/ec2_group.py index 0669c3fdcc1..95130d32534 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_group.py +++ b/lib/ansible/modules/cloud/amazon/ec2_group.py @@ -1,19 +1,10 @@ #!/usr/bin/python # -*- coding: utf-8 -*- # This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], @@ -27,7 +18,7 @@ version_added: "1.3" requirements: [ boto3 ] short_description: maintain an ec2 VPC security group. description: - - maintains ec2 security groups. This module has a dependency on python-boto >= 2.5 + - Maintains ec2 security groups. This module has a dependency on python-boto >= 2.5. options: name: description: @@ -35,20 +26,24 @@ options: - One of and only one of I(name) or I(group_id) is required. - Required if I(state=present). required: false + type: str group_id: description: - Id of group to delete (works only with absent). - One of and only one of I(name) or I(group_id) is required. required: false version_added: "2.4" + type: str description: description: - Description of the security group. Required when C(state) is C(present). required: false + type: str vpc_id: description: - ID of the VPC to create the group in. required: false + type: str rules: description: - List of firewall inbound rules to enforce in this group (see example). If none are supplied, @@ -58,6 +53,60 @@ options: source type as well as multiple source types per rule. Prior to 2.4 an individual source is allowed. In version 2.5 support for rule descriptions was added. required: false + type: list + elements: dict + suboptions: + cidr_ip: + type: str + description: + - The IPv4 CIDR range traffic is coming from. + - You can specify only one of I(cidr_ip), I(cidr_ipv6), I(ip_prefix), I(group_id) + and I(group_name). + cidr_ipv6: + type: str + description: + - The IPv6 CIDR range traffic is coming from. + - You can specify only one of I(cidr_ip), I(cidr_ipv6), I(ip_prefix), I(group_id) + and I(group_name). + ip_prefix: + type: str + description: + - The IP Prefix U(https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-prefix-lists.html) + that traffic is coming from. + - You can specify only one of I(cidr_ip), I(cidr_ipv6), I(ip_prefix), I(group_id) + and I(group_name). + group_id: + type: str + description: + - The ID of the Security Group that traffic is coming from. + - You can specify only one of I(cidr_ip), I(cidr_ipv6), I(ip_prefix), I(group_id) + and I(group_name). + group_name: + type: str + description: + - Name of the Security Group that traffic is coming from. + - If the Security Group doesn't exist a new Security Group will be + created with I(group_desc) as the description. + - You can specify only one of I(cidr_ip), I(cidr_ipv6), I(ip_prefix), I(group_id) + and I(group_name). + group_desc: + type: str + description: + - If the I(group_name) is set and the Security Group doesn't exist a new Security Group will be + created with I(group_desc) as the description. + proto: + type: str + description: + - The IP protocol name (C(tcp), C(udp), C(icmp), C(icmpv6)) or number (U(https://en.wikipedia.org/wiki/List_of_IP_protocol_numbers)) + from_port: + type: int + description: The start of the range of ports that traffic is coming from. A value of C(-1) indicates all ports. + to_port: + type: int + description: The end of the range of ports that traffic is coming from. A value of C(-1) indicates all ports. + rule_desc: + type: str + description: A description for the rule. rules_egress: description: - List of firewall outbound rules to enforce in this group (see example). If none are supplied, @@ -66,18 +115,73 @@ options: was added. required: false version_added: "1.6" + type: list + elements: dict + suboptions: + cidr_ip: + type: str + description: + - The IPv4 CIDR range traffic is going to. + - You can specify only one of I(cidr_ip), I(cidr_ipv6), I(ip_prefix), I(group_id) + and I(group_name). + cidr_ipv6: + type: str + description: + - The IPv6 CIDR range traffic is going to. + - You can specify only one of I(cidr_ip), I(cidr_ipv6), I(ip_prefix), I(group_id) + and I(group_name). + ip_prefix: + type: str + description: + - The IP Prefix U(https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-prefix-lists.html) + that traffic is going to. + - You can specify only one of I(cidr_ip), I(cidr_ipv6), I(ip_prefix), I(group_id) + and I(group_name). + group_id: + type: str + description: + - The ID of the Security Group that traffic is going to. + - You can specify only one of I(cidr_ip), I(cidr_ipv6), I(ip_prefix), I(group_id) + and I(group_name). + group_name: + type: str + description: + - Name of the Security Group that traffic is going to. + - If the Security Group doesn't exist a new Security Group will be + created with I(group_desc) as the description. + - You can specify only one of I(cidr_ip), I(cidr_ipv6), I(ip_prefix), I(group_id) + and I(group_name). + group_desc: + type: str + description: + - If the I(group_name) is set and the Security Group doesn't exist a new Security Group will be + created with I(group_desc) as the description. + proto: + type: str + description: + - The IP protocol name (C(tcp), C(udp), C(icmp), C(icmpv6)) or number (U(https://en.wikipedia.org/wiki/List_of_IP_protocol_numbers)) + from_port: + type: int + description: The start of the range of ports that traffic is going to. A value of C(-1) indicates all ports. + to_port: + type: int + description: The end of the range of ports that traffic is going to. A value of C(-1) indicates all ports. + rule_desc: + type: str + description: A description for the rule. state: version_added: "1.4" description: - - Create or delete a security group + - Create or delete a security group. required: false default: 'present' choices: [ "present", "absent" ] aliases: [] + type: str purge_rules: version_added: "1.8" description: - - Purge existing rules on security group that are not found in rules + - Purge existing rules on security group that are not found in rules. required: false default: 'true' aliases: [] @@ -85,7 +189,7 @@ options: purge_rules_egress: version_added: "1.8" description: - - Purge existing rules_egress on security group that are not found in rules_egress + - Purge existing rules_egress on security group that are not found in rules_egress. required: false default: 'true' aliases: [] @@ -95,6 +199,8 @@ options: description: - A dictionary of one or more tags to assign to the security group. required: false + type: dict + aliases: ['resource_tags'] purge_tags: version_added: "2.4" description: diff --git a/lib/ansible/modules/cloud/amazon/ec2_group_info.py b/lib/ansible/modules/cloud/amazon/ec2_group_info.py index e20c46e7f29..2bcd99d27fc 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_group_info.py +++ b/lib/ansible/modules/cloud/amazon/ec2_group_info.py @@ -31,6 +31,7 @@ options: instead of dashes (-) in the filter keys, which will take precedence in case of conflict. required: false default: {} + type: dict notes: - By default, the module will return all security groups. To limit results use the appropriate filters. diff --git a/lib/ansible/modules/cloud/amazon/ec2_key.py b/lib/ansible/modules/cloud/amazon/ec2_key.py index e3c9b14fda3..1a8c873c2f4 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_key.py +++ b/lib/ansible/modules/cloud/amazon/ec2_key.py @@ -24,10 +24,12 @@ options: description: - Name of the key pair. required: true + type: str key_material: description: - Public key material. required: false + type: str force: description: - Force overwrite of already existing key pair if key has changed. @@ -41,19 +43,18 @@ options: required: false choices: [ present, absent ] default: 'present' + type: str wait: description: - - Wait for the specified action to complete before returning. This option has no effect since version 2.5. - required: false - default: false - type: bool + - This option has no effect since version 2.5 and will be removed in 2.14. version_added: "1.6" + type: bool wait_timeout: description: - - How long before wait gives up, in seconds. This option has no effect since version 2.5. - required: false - default: 300 + - This option has no effect since version 2.5 and will be removed in 2.14. version_added: "1.6" + type: int + required: false extends_documentation_fragment: - aws @@ -248,8 +249,8 @@ def main(): key_material=dict(), force=dict(type='bool', default=True), state=dict(default='present', choices=['present', 'absent']), - wait=dict(type='bool', default=False), - wait_timeout=dict(default=300, type='int') + wait=dict(type='bool', removed_in_version='2.14'), + wait_timeout=dict(type='int', removed_in_version='2.14') ) ) diff --git a/lib/ansible/modules/cloud/amazon/ec2_launch_template.py b/lib/ansible/modules/cloud/amazon/ec2_launch_template.py index dfc4421b062..87dabfc76da 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_launch_template.py +++ b/lib/ansible/modules/cloud/amazon/ec2_launch_template.py @@ -34,13 +34,16 @@ options: description: - The ID for the launch template, can be used for all cases except creating a new Launch Template. aliases: [id] + type: str template_name: description: - The template name. This must be unique in the region-account combination you are using. aliases: [name] + type: str default_version: description: - Which version should be the default when users spin up new instances based on this template? By default, the latest version will be made the default. + type: str default: latest state: description: @@ -48,6 +51,7 @@ options: - Deleting specific versions of a launch template is not supported at this time. choices: [present, absent] default: present + type: str block_device_mappings: description: - The block device mapping. Supplying both a snapshot ID and an encryption @@ -56,11 +60,15 @@ options: created from a snapshot. If a snapshot is the basis for the volume, it contains data by definition and its encryption status cannot be changed using this action. + type: list + elements: dict suboptions: device_name: description: The device name (for example, /dev/sdh or xvdh). + type: str no_device: description: Suppresses the specified device included in the block device mapping of the AMI. + type: str virtual_name: description: > The virtual device name (ephemeralN). Instance store volumes are @@ -68,8 +76,10 @@ options: store volumes can specify mappings for ephemeral0 and ephemeral1. The number of available instance store volumes depends on the instance type. After you connect to the instance, you must mount the volume. + type: str ebs: - description: Parameters used to automatically set up EBS volumes when the instance is launched. + description: Parameters used to automatically set up EBS volumes when the instance is launchedself + type: dict suboptions: delete_on_termination: description: Indicates whether the EBS volume is deleted on instance termination. @@ -80,6 +90,7 @@ options: can only be attached to instances that support Amazon EBS encryption. If you are creating a volume from a snapshot, you can't specify an encryption value. + type: bool iops: description: - The number of I/O operations per second (IOPS) that the volume @@ -94,36 +105,45 @@ options: Condition: This parameter is required for requests to create io1 volumes; it is not used in requests to create gp2, st1, sc1, or standard volumes. + type: int kms_key_id: description: The ARN of the AWS Key Management Service (AWS KMS) CMK used for encryption. + type: str snapshot_id: - description: The ID of the snapshot to create the volume from + description: The ID of the snapshot to create the volume from. + type: str volume_size: description: - The size of the volume, in GiB. - "Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size." + type: int volume_type: description: The volume type + type: str cpu_options: description: - Choose CPU settings for the EC2 instances that will be created with this template. - For more information, see U(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) + type: dict suboptions: core_count: description: The number of CPU cores for the instance. + type: int threads_per_core: description: > The number of threads per CPU core. To disable Intel Hyper-Threading Technology for the instance, specify a value of 1. Otherwise, specify the default value of 2. + type: int credit_specification: - description: The credit option for CPU usage of the instance. Valid for T2 or T3 instances only. + description: The credit option for CPU usage of the instance. Valid for T2 or T3 instances onlyself. + type: dict suboptions: cpu_credits: description: > The credit option for CPU usage of a T2 or T3 instance. Valid values - are I(standard) and I(unlimited). - choices: [standard, unlimited] + are C(standard) and C(unlimited). + type: str disable_api_termination: description: > This helps protect instances from accidental termination. If set to true, @@ -140,69 +160,86 @@ options: charges apply when using an EBS-optimized instance. type: bool elastic_gpu_specifications: + type: list + elements: dict description: Settings for Elastic GPU attachments. See U(https://aws.amazon.com/ec2/elastic-gpus/) for details. suboptions: type: description: The type of Elastic GPU to attach + type: str iam_instance_profile: description: > The name or ARN of an IAM instance profile. Requires permissions to describe existing instance roles to confirm ARN is properly formed. + type: str image_id: description: > The AMI ID to use for new instances launched with this template. This value is region-dependent since AMIs are not global resources. + type: str instance_initiated_shutdown_behavior: description: > Indicates whether an instance stops or terminates when you initiate shutdown from the instance using the operating system shutdown command. choices: [stop, terminate] + type: str instance_market_options: description: Options for alternative instance markets, currently only the spot market is supported. + type: dict suboptions: market_type: description: The market type. This should always be 'spot'. + type: str spot_options: - description: Spot-market specific settings + description: Spot-market specific settings. + type: dict suboptions: block_duration_minutes: description: > The required duration for the Spot Instances (also known as Spot blocks), in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360). + type: int instance_interruption_behavior: - description: The behavior when a Spot Instance is interrupted. The default is I(terminate) + description: The behavior when a Spot Instance is interrupted. The default is C(terminate). choices: [hibernate, stop, terminate] + type: str max_price: description: The highest hourly price you're willing to pay for this Spot Instance. + type: str spot_instance_type: description: The request type to send. choices: [one-time, persistent] - type: dict + type: str instance_type: description: > - The instance type, such as I(c5.2xlarge). For a full list of instance types, see + The instance type, such as C(c5.2xlarge). For a full list of instance types, see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html + type: str kernel_id: description: > The ID of the kernel. We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see U(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + type: str key_name: description: - - The name of the key pair. You can create a key pair using - I(CreateKeyPair) or I(ImportKeyPair). + - The name of the key pair. You can create a key pair using M(ec2_key). - If you do not specify a key pair, you can't connect to the instance unless you choose an AMI that is configured to allow users another way to log in. + type: str monitoring: - description: Settings for instance monitoring + description: Settings for instance monitoring. + type: dict suboptions: enabled: type: bool description: Whether to turn on detailed monitoring for new instances. This will incur extra charges. network_interfaces: description: One or more network interfaces. + type: list + elements: dict suboptions: associate_public_ip_address: description: Associates a public IPv4 address with eth0 for a new network interface. @@ -212,63 +249,71 @@ options: type: bool description: description: A description for the network interface. + type: str device_index: description: The device index for the network interface attachment. + type: int groups: - description: List of security group IDs to include on this instance + description: List of security group IDs to include on this instance. + type: list + elements: str ipv6_address_count: description: > The number of IPv6 addresses to assign to a network interface. Amazon EC2 automatically selects the IPv6 addresses from the subnet range. You can't use this option if specifying the I(ipv6_addresses) option. + type: int ipv6_addresses: description: > A list of one or more specific IPv6 addresses from the IPv6 CIDR block range of your subnet. You can't use this option if you're specifying the I(ipv6_address_count) option. + type: list + elements: int network_interface_id: description: The eni ID of a network interface to attach. + type: str private_ip_address: description: The primary private IPv4 address of the network interface. - private_ip_addresses: - description: One or more private IPv4 addresses. - suboptions: - primary: - description: > - Indicates whether the private IPv4 address is the primary private - IPv4 address. Only one IPv4 address can be designated as primary. - private_ip_address: - description: The primary private IPv4 address of the network interface. + type: str subnet_id: description: The ID of the subnet for the network interface. - secondary_private_ip_address_count: - description: The number of secondary private IPv4 addresses to assign to a network interface. + type: str placement: description: The placement group settings for the instance. + type: dict suboptions: affinity: description: The affinity setting for an instance on a Dedicated Host. + type: str availability_zone: description: The Availability Zone for the instance. + type: str group_name: description: The name of the placement group for the instance. + type: str host_id: description: The ID of the Dedicated Host for the instance. + type: str tenancy: description: > The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. + type: str ram_disk_id: description: > The ID of the RAM disk to launch the instance with. We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see U(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + type: str security_group_ids: description: A list of security group IDs (VPC or EC2-Classic) that the new instances will be added to. type: list + elements: str security_groups: description: A list of security group names (VPC or EC2-Classic) that the new instances will be added to. type: list + elements: str tags: type: dict description: @@ -281,6 +326,7 @@ options: U(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) and Windows U(http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data) documentation on user-data. + type: str ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/amazon/ec2_lc.py b/lib/ansible/modules/cloud/amazon/ec2_lc.py index 4833e2fba4c..b1a46994cd6 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_lc.py +++ b/lib/ansible/modules/cloud/amazon/ec2_lc.py @@ -1,18 +1,10 @@ #!/usr/bin/python # This file is part of Ansible # -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], @@ -26,8 +18,8 @@ module: ec2_lc short_description: Create or delete AWS Autoscaling Launch Configurations description: - - Can create or delete AWS Autoscaling Configurations - - Works with the ec2_asg module to manage Autoscaling Groups + - Can create or delete AWS Autoscaling Configurations. + - Works with the ec2_asg module to manage Autoscaling Groups. notes: - Amazon ASG Autoscaling Launch Configurations are immutable once created, so modifying the configuration after it is changed will not modify the @@ -43,89 +35,117 @@ author: options: state: description: - - Register or deregister the instance + - Register or deregister the instance. default: present choices: ['present', 'absent'] + type: str name: description: - - Unique name for configuration + - Unique name for configuration. required: true + type: str instance_type: description: - - Instance type to use for the instance + - Instance type to use for the instance. required: true + type: str image_id: description: - - The AMI unique identifier to be used for the group + - The AMI unique identifier to be used for the group. + type: str key_name: description: - - The SSH key name to be used for access to managed instances + - The SSH key name to be used for access to managed instances. + type: str security_groups: description: - A list of security groups to apply to the instances. Since version 2.4 you can specify either security group names or IDs or a mix. Previous to 2.4, for VPC instances, specify security group IDs and for EC2-Classic, specify either security group names or IDs. + type: list + elements: str volumes: description: - A list of volume dicts, each containing device name and optionally ephemeral id or snapshot id. Size and type (and number of iops for io device type) must be specified for a new volume or a root volume, and may be passed for a snapshot volume. For any volume, a volume size less than 1 will be interpreted as a request not to create the volume. + type: list + elements: dict user_data: description: - Opaque blob of data which is made available to the ec2 instance. Mutually exclusive with I(user_data_path). + type: str user_data_path: description: - Path to the file that contains userdata for the ec2 instances. Mutually exclusive with I(user_data). version_added: "2.3" + type: path kernel_id: description: - - Kernel id for the EC2 instance + - Kernel id for the EC2 instance. + type: str spot_price: description: - The spot price you are bidding. Only applies for an autoscaling group with spot instances. + type: float instance_monitoring: description: - Specifies whether instances are launched with detailed monitoring. type: bool - default: 'no' + default: false assign_public_ip: description: - Used for Auto Scaling groups that launch instances into an Amazon Virtual Private Cloud. Specifies whether to assign a public IP address to each instance launched in a Amazon VPC. version_added: "1.8" + type: bool ramdisk_id: description: - A RAM disk id for the instances. version_added: "1.8" + type: str instance_profile_name: description: - The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instances. version_added: "1.8" + type: str ebs_optimized: description: - Specifies whether the instance is optimized for EBS I/O (true) or not (false). default: false version_added: "1.8" + type: bool classic_link_vpc_id: description: - Id of ClassicLink enabled VPC version_added: "2.0" + type: str classic_link_vpc_security_groups: description: - A list of security group IDs with which to associate the ClassicLink VPC instances. version_added: "2.0" + type: list + elements: str vpc_id: description: - VPC ID, used when resolving security group names to IDs. version_added: "2.4" + type: str instance_id: description: - - The Id of a running instance to use as a basis for a launch configuration. Can be used in place of image_id and instance_type. + - The Id of a running instance to use as a basis for a launch configuration. Can be used in place of I(image_id) and I(instance_type). version_added: "2.4" + type: str placement_tenancy: description: - Determines whether the instance runs on single-tenant hardware or not. - default: 'default' + - When not set AWS will default to C(default). version_added: "2.4" + type: str + choices: ['default', 'dedicated'] + associate_public_ip_address: + description: + - The I(wait_timeout) option does nothing and will be removed in Ansible 2.14. + type: bool extends_documentation_fragment: - aws @@ -228,8 +248,8 @@ result: associate_public_ip_address: description: (EC2-VPC) Indicates whether to assign a public IP address to each instance. returned: when I(state=present) - type: NoneType - sample: null + type: bool + sample: false block_device_mappings: description: A block device mapping, which specifies the block devices. returned: when I(state=present) @@ -248,8 +268,7 @@ result: snapshot_id: description: The ID of the snapshot. returned: when I(state=present) - type: NoneType - sample: null + type: str volume_size: description: The volume size, in GiB. returned: when I(state=present) @@ -258,13 +277,12 @@ result: virtual_name: description: The name of the virtual device (for example, ephemeral0). returned: when I(state=present) - type: NoneType - sample: null + type: str + sample: ephemeral0 classic_link_vpc_id: description: The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to. returned: when I(state=present) - type: NoneType - sample: null + type: str classic_link_vpc_security_groups: description: The IDs of one or more security groups for the VPC specified in ClassicLinkVPCId. returned: when I(state=present) @@ -308,8 +326,7 @@ result: iops: description: The number of I/O operations per second (IOPS) to provision for the volume. returned: when I(state=present) - type: NoneType - sample: null + type: int kernel_id: description: The ID of the kernel associated with the AMI. returned: when I(state=present) @@ -349,8 +366,7 @@ result: spot_price: description: The price to bid when launching Spot Instances. returned: when I(state=present) - type: NoneType - sample: null + type: float use_block_device_types: description: Indicates whether to suppress a device mapping. returned: when I(state=present) @@ -364,8 +380,8 @@ result: volume_type: description: The volume type (one of standard, io1, gp2). returned: when I(state=present) - type: NoneType - sample: null + type: str + sample: io1 security_groups: description: The security groups to associate with the instances. returned: when I(state=present) @@ -589,7 +605,7 @@ def main(): ramdisk_id=dict(), instance_profile_name=dict(), ebs_optimized=dict(default=False, type='bool'), - associate_public_ip_address=dict(type='bool'), + associate_public_ip_address=dict(type='bool', removed_in_version='2.14'), instance_monitoring=dict(default=False, type='bool'), assign_public_ip=dict(type='bool'), classic_link_vpc_security_groups=dict(type='list'), diff --git a/lib/ansible/modules/cloud/amazon/ec2_lc_find.py b/lib/ansible/modules/cloud/amazon/ec2_lc_find.py index c4dcdc9ea4f..a972e7f052e 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_lc_find.py +++ b/lib/ansible/modules/cloud/amazon/ec2_lc_find.py @@ -18,37 +18,36 @@ DOCUMENTATION = """ module: ec2_lc_find short_description: Find AWS Autoscaling Launch Configurations description: - - Returns list of matching Launch Configurations for a given name, along with other useful information - - Results can be sorted and sliced - - It depends on boto - - Based on the work by Tom Bamford (https://github.com/tombamford) + - Returns list of matching Launch Configurations for a given name, along with other useful information. + - Results can be sorted and sliced. + - It depends on boto. + - Based on the work by Tom Bamford U(https://github.com/tombamford) version_added: "2.2" author: "Jose Armesto (@fiunchinho)" options: - region: - description: - - The AWS region to use. - required: true - aliases: ['aws_region', 'ec2_region'] name_regex: description: - - A Launch Configuration to match - - It'll be compiled as regex + - A Launch Configuration to match. + - It'll be compiled as regex. required: True + type: str sort_order: description: - Order in which to sort results. choices: ['ascending', 'descending'] default: 'ascending' + type: str limit: description: - How many results to show. - Corresponds to Python slice notation like list[:limit]. + type: int requirements: - "python >= 2.6" - boto3 extends_documentation_fragment: + - ec2 - aws """ @@ -198,7 +197,6 @@ def find_launch_configs(client, module): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - region=dict(required=True, aliases=['aws_region', 'ec2_region']), name_regex=dict(required=True), sort_order=dict(required=False, default='ascending', choices=['ascending', 'descending']), limit=dict(required=False, type='int'), diff --git a/lib/ansible/modules/cloud/amazon/ec2_lc_info.py b/lib/ansible/modules/cloud/amazon/ec2_lc_info.py index d7908736f17..7c963224e07 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_lc_info.py +++ b/lib/ansible/modules/cloud/amazon/ec2_lc_info.py @@ -15,9 +15,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', DOCUMENTATION = ''' --- module: ec2_lc_info -short_description: Gather information about AWS Autoscaling Launch Configurations +short_description: Gather information about AWS Autoscaling Launch Configurations. description: - - Gather information about AWS Autoscaling Launch Configurations + - Gather information about AWS Autoscaling Launch Configurations. - This module was called C(ec2_lc_facts) before Ansible 2.9. The usage did not change. version_added: "2.3" author: "Loïc Latreille (@psykotox)" @@ -27,24 +27,30 @@ options: description: - A name or a list of name to match. default: [] + type: list + elements: str sort: description: - Optional attribute which with to sort the results. choices: ['launch_configuration_name', 'image_id', 'created_time', 'instance_type', 'kernel_id', 'ramdisk_id', 'key_name'] + type: str sort_order: description: - Order in which to sort results. - Only used when the 'sort' parameter is specified. choices: ['ascending', 'descending'] default: 'ascending' + type: str sort_start: description: - Which result to start with (when sorting). - Corresponds to Python slice notation. + type: int sort_end: description: - Which result to end with (when sorting). - Corresponds to Python slice notation. + type: int extends_documentation_fragment: - aws - ec2 @@ -186,15 +192,12 @@ def list_launch_configs(connection, module): if sort: snaked_launch_configs.sort(key=lambda e: e[sort], reverse=(sort_order == 'descending')) - try: - if sort and sort_start and sort_end: - snaked_launch_configs = snaked_launch_configs[int(sort_start):int(sort_end)] - elif sort and sort_start: - snaked_launch_configs = snaked_launch_configs[int(sort_start):] - elif sort and sort_end: - snaked_launch_configs = snaked_launch_configs[:int(sort_end)] - except TypeError: - module.fail_json(msg="Please supply numeric values for sort_start and/or sort_end") + if sort and sort_start and sort_end: + snaked_launch_configs = snaked_launch_configs[sort_start:sort_end] + elif sort and sort_start: + snaked_launch_configs = snaked_launch_configs[sort_start:] + elif sort and sort_end: + snaked_launch_configs = snaked_launch_configs[:sort_end] module.exit_json(launch_configurations=snaked_launch_configs) @@ -208,8 +211,8 @@ def main(): choices=['launch_configuration_name', 'image_id', 'created_time', 'instance_type', 'kernel_id', 'ramdisk_id', 'key_name']), sort_order=dict(required=False, default='ascending', choices=['ascending', 'descending']), - sort_start=dict(required=False), - sort_end=dict(required=False), + sort_start=dict(required=False, type='int'), + sort_end=dict(required=False, type='int'), ) ) diff --git a/lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py b/lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py index 62bc4f210c6..2eee43811b9 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py @@ -23,7 +23,7 @@ author: description: - This module fetches data from the instance metadata endpoint in ec2 as per U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html). - The module must be called from within the EC2 instance itself. + - The module must be called from within the EC2 instance itself. notes: - Parameters to filter on ec2_metadata_facts may be added later. ''' @@ -50,19 +50,19 @@ ansible_facts: ansible_ec2_ami_launch_index: description: - If you started more than one instance at the same time, this value indicates the order in which the instance was launched. - The value of the first instance launched is 0. + - The value of the first instance launched is 0. type: str sample: "0" ansible_ec2_ami_manifest_path: description: - The path to the AMI manifest file in Amazon S3. - If you used an Amazon EBS-backed AMI to launch the instance, the returned result is unknown. + - If you used an Amazon EBS-backed AMI to launch the instance, the returned result is unknown. type: str sample: "(unknown)" ansible_ec2_ancestor_ami_ids: description: - The AMI IDs of any instances that were rebundled to create this AMI. - This value will only exist if the AMI manifest file contained an ancestor-amis key. + - This value will only exist if the AMI manifest file contained an ancestor-amis key. type: str sample: "(unknown)" ansible_ec2_block_device_mapping_ami: @@ -72,8 +72,8 @@ ansible_facts: ansible_ec2_block_device_mapping_ebsN: description: - The virtual devices associated with Amazon EBS volumes, if any are present. - Amazon EBS volumes are only available in metadata if they were present at launch time or when the instance was last started. - The N indicates the index of the Amazon EBS volume (such as ebs1 or ebs2). + - Amazon EBS volumes are only available in metadata if they were present at launch time or when the instance was last started. + - The N indicates the index of the Amazon EBS volume (such as ebs1 or ebs2). type: str sample: "/dev/xvdb" ansible_ec2_block_device_mapping_ephemeralN: @@ -97,7 +97,7 @@ ansible_facts: ansible_ec2_hostname: description: - The private IPv4 DNS hostname of the instance. - In cases where multiple network interfaces are present, this refers to the eth0 device (the device for which the device number is 0). + - In cases where multiple network interfaces are present, this refers to the eth0 device (the device for which the device number is 0). type: str sample: "ip-10-0-0-1.ec2.internal" ansible_ec2_iam_info: @@ -106,6 +106,16 @@ ansible_facts: including the instance's LastUpdated date, InstanceProfileArn, and InstanceProfileId. Otherwise, not present. type: complex sample: "" + contains: + LastUpdated: + description: The last time which InstanceProfile is associated with the Instance changed. + type: str + InstanceProfileArn: + description: The ARN of the InstanceProfile associated with the Instance. + type: str + InstanceProfileId: + description: The Id of the InstanceProfile associated with the Instance. + type: str ansible_ec2_iam_info_instanceprofilearn: description: The IAM instance profile ARN. type: str @@ -211,7 +221,7 @@ ansible_facts: ansible_ec2_instance_identity_document_privateip: description: - The private IPv4 address of the instance. - In cases where multiple network interfaces are present, this refers to the eth0 device (the device for which the device number is 0). + - In cases where multiple network interfaces are present, this refers to the eth0 device (the device for which the device number is 0). type: str sample: "10.0.0.1" ansible_ec2_instance_identity_document_ramdiskid: @@ -245,19 +255,19 @@ ansible_facts: ansible_ec2_local_hostname: description: - The private IPv4 DNS hostname of the instance. - In cases where multiple network interfaces are present, this refers to the eth0 device (the device for which the device number is 0). + - In cases where multiple network interfaces are present, this refers to the eth0 device (the device for which the device number is 0). type: str sample: "ip-10-0-0-1.ec2.internal" ansible_ec2_local_ipv4: description: - The private IPv4 address of the instance. - In cases where multiple network interfaces are present, this refers to the eth0 device (the device for which the device number is 0). + - In cases where multiple network interfaces are present, this refers to the eth0 device (the device for which the device number is 0). type: str sample: "10.0.0.1" ansible_ec2_mac: description: - The instance's media access control (MAC) address. - In cases where multiple network interfaces are present, this refers to the eth0 device (the device for which the device number is 0). + - In cases where multiple network interfaces are present, this refers to the eth0 device (the device for which the device number is 0). type: str sample: "00:11:22:33:44:55" ansible_ec2_metrics_vhostmd: @@ -268,7 +278,7 @@ ansible_facts: description: - The unique device number associated with that interface. The device number corresponds to the device name; for example, a device-number of 2 is for the eth2 device. - This category corresponds to the DeviceIndex and device-index fields that are used by the Amazon EC2 API and the EC2 commands for the AWS CLI. + - This category corresponds to the DeviceIndex and device-index fields that are used by the Amazon EC2 API and the EC2 commands for the AWS CLI. type: str sample: "0" ansible_ec2_network_interfaces_macs__interface_id: @@ -298,8 +308,8 @@ ansible_facts: ansible_ec2_network_interfaces_macs__owner_id: description: - The ID of the owner of the network interface. - In multiple-interface environments, an interface can be attached by a third party, such as Elastic Load Balancing. - Traffic on an interface is always billed to the interface owner. + - In multiple-interface environments, an interface can be attached by a third party, such as Elastic Load Balancing. + - Traffic on an interface is always billed to the interface owner. type: str sample: "01234567890" ansible_ec2_network_interfaces_macs__public_hostname: @@ -388,7 +398,7 @@ ansible_facts: ansible_ec2_security_groups: description: - The names of the security groups applied to the instance. After launch, you can only change the security groups of instances running in a VPC. - Such changes are reflected here and in network/interfaces/macs/mac/security-groups. + - Such changes are reflected here and in network/interfaces/macs/mac/security-groups. type: str sample: "securitygroup1,securitygroup2" ansible_ec2_services_domain: @@ -398,15 +408,15 @@ ansible_facts: ansible_ec2_services_partition: description: - The partition that the resource is in. For standard AWS regions, the partition is aws. - If you have resources in other partitions, the partition is aws-partitionname. - For example, the partition for resources in the China (Beijing) region is aws-cn. + - If you have resources in other partitions, the partition is aws-partitionname. + - For example, the partition for resources in the China (Beijing) region is aws-cn. type: str sample: "aws" ansible_ec2_spot_termination_time: description: - The approximate time, in UTC, that the operating system for your Spot instance will receive the shutdown signal. - This item is present and contains a time value only if the Spot instance has been marked for termination by Amazon EC2. - The termination-time item is not set to a time if you terminated the Spot instance yourself. + - This item is present and contains a time value only if the Spot instance has been marked for termination by Amazon EC2. + - The termination-time item is not set to a time if you terminated the Spot instance yourself. type: str sample: "2015-01-05T18:02:00Z" ansible_ec2_user_data: diff --git a/lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py b/lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py index bcf09c67691..42f1416c813 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py +++ b/lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py @@ -22,49 +22,59 @@ author: "Zacharie Eakin (@Zeekin)" options: state: description: - - register or deregister the alarm - required: true + - Register or deregister the alarm. choices: ['present', 'absent'] + default: 'present' + type: str name: description: - - Unique name for the alarm + - Unique name for the alarm. required: true + type: str metric: description: - - Name of the monitored metric (e.g. CPUUtilization) - - Metric must already exist + - Name of the monitored metric (e.g. C(CPUUtilization)). + - Metric must already exist. required: false + type: str namespace: description: - - Name of the appropriate namespace ('AWS/EC2', 'System/Linux', etc.), which determines the category it will appear under in cloudwatch + - Name of the appropriate namespace (C(AWS/EC2), C(System/Linux), etc.), which determines the category it will appear under in cloudwatch. required: false + type: str statistic: description: - - Operation applied to the metric - - Works in conjunction with period and evaluation_periods to determine the comparison value + - Operation applied to the metric. + - Works in conjunction with I(period) and I(evaluation_periods) to determine the comparison value. required: false choices: ['SampleCount','Average','Sum','Minimum','Maximum'] + type: str comparison: description: - - Determines how the threshold value is compared + - Determines how the threshold value is compared. required: false choices: ['<=','<','>','>='] + type: str threshold: description: - - Sets the min/max bound for triggering the alarm + - Sets the min/max bound for triggering the alarm. required: false + type: float period: description: - - The time (in seconds) between metric evaluations + - The time (in seconds) between metric evaluations. required: false + type: int evaluation_periods: description: - - The number of times in which the metric is evaluated before final calculation + - The number of times in which the metric is evaluated before final calculation. required: false + type: int unit: description: - - The threshold's unit of measurement + - The threshold's unit of measurement. required: false + type: str choices: - 'Seconds' - 'Microseconds' @@ -95,24 +105,34 @@ options: - 'None' description: description: - - A longer description of the alarm + - A longer description of the alarm. required: false + type: str dimensions: description: - - Describes to what the alarm is applied + - A dictionary describing which metric the alarm is applied to. + - 'For more information see the AWS documentation:' + - U(https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension) required: false + type: dict alarm_actions: description: - - A list of the names action(s) taken when the alarm is in the 'alarm' status, denoted as Amazon Resource Name(s) + - A list of the names action(s) taken when the alarm is in the C(alarm) status, denoted as Amazon Resource Name(s). required: false + type: list + elements: str insufficient_data_actions: description: - - A list of the names of action(s) to take when the alarm is in the 'insufficient_data' status + - A list of the names of action(s) to take when the alarm is in the C(insufficient_data) status. required: false + type: list + elements: str ok_actions: description: - - A list of the names of action(s) to take when the alarm is in the 'ok' status, denoted as Amazon Resource Name(s) + - A list of the names of action(s) to take when the alarm is in the C(ok) status, denoted as Amazon Resource Name(s). required: false + type: list + elements: str extends_documentation_fragment: - aws - ec2 diff --git a/lib/ansible/modules/cloud/amazon/ec2_placement_group.py b/lib/ansible/modules/cloud/amazon/ec2_placement_group.py index b3cfaa20e2e..11dfb3c01c4 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_placement_group.py +++ b/lib/ansible/modules/cloud/amazon/ec2_placement_group.py @@ -2,6 +2,9 @@ # Copyright (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} @@ -23,12 +26,14 @@ options: description: - The name for the placement group. required: true + type: str state: description: - Create or delete placement group. required: false default: present choices: [ 'present', 'absent' ] + type: str strategy: description: - Placement group strategy. Cluster will cluster instances into a @@ -37,6 +42,7 @@ options: required: false default: cluster choices: [ 'cluster', 'spread' ] + type: str extends_documentation_fragment: - aws - ec2 diff --git a/lib/ansible/modules/cloud/amazon/ec2_placement_group_info.py b/lib/ansible/modules/cloud/amazon/ec2_placement_group_info.py index 950e7c5cad1..eee1912a8fe 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_placement_group_info.py +++ b/lib/ansible/modules/cloud/amazon/ec2_placement_group_info.py @@ -2,6 +2,9 @@ # Copyright (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} @@ -21,6 +24,8 @@ options: description: - A list of names to filter on. If a listed group does not exist, there will be no corresponding entry in the result; no error will be raised. + type: list + elements: str required: false default: [] extends_documentation_fragment: diff --git a/lib/ansible/modules/cloud/amazon/ec2_scaling_policy.py b/lib/ansible/modules/cloud/amazon/ec2_scaling_policy.py index b6dd83e7ece..a9c41e3cbc0 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_scaling_policy.py +++ b/lib/ansible/modules/cloud/amazon/ec2_scaling_policy.py @@ -15,41 +15,49 @@ DOCUMENTATION = """ module: ec2_scaling_policy short_description: Create or delete AWS scaling policies for Autoscaling groups description: - - Can create or delete scaling policies for autoscaling groups - - Referenced autoscaling groups must already exist + - Can create or delete scaling policies for autoscaling groups. + - Referenced autoscaling groups must already exist. version_added: "1.6" author: "Zacharie Eakin (@Zeekin)" options: state: description: - - register or deregister the policy + - Register or deregister the policy. required: true + default: present choices: ['present', 'absent'] + type: str name: description: - - Unique name for the scaling policy + - Unique name for the scaling policy. required: true + type: str asg_name: description: - - Name of the associated autoscaling group + - Name of the associated autoscaling group. required: true + type: str adjustment_type: description: - - The type of change in capacity of the autoscaling group + - The type of change in capacity of the autoscaling group. required: false choices: ['ChangeInCapacity','ExactCapacity','PercentChangeInCapacity'] + type: str scaling_adjustment: description: - - The amount by which the autoscaling group is adjusted by the policy + - The amount by which the autoscaling group is adjusted by the policy. required: false + type: int min_adjustment_step: description: - - Minimum amount of adjustment when policy is triggered + - Minimum amount of adjustment when policy is triggered. required: false + type: int cooldown: description: - - The minimum period of time between which autoscaling actions can take place + - The minimum period of time (in seconds) between which autoscaling actions can take place. required: false + type: int extends_documentation_fragment: - aws - ec2 diff --git a/lib/ansible/modules/cloud/amazon/ec2_snapshot.py b/lib/ansible/modules/cloud/amazon/ec2_snapshot.py index c1f1a495af5..dcaceeb41b4 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_snapshot.py +++ b/lib/ansible/modules/cloud/amazon/ec2_snapshot.py @@ -14,64 +14,73 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', DOCUMENTATION = ''' --- module: ec2_snapshot -short_description: creates a snapshot from an existing volume +short_description: Creates a snapshot from an existing volume description: - - creates an EC2 snapshot from an existing EBS volume + - Creates an EC2 snapshot from an existing EBS volume. version_added: "1.5" options: volume_id: description: - - volume from which to take the snapshot + - Volume from which to take the snapshot. required: false + type: str description: description: - - description to be applied to the snapshot + - Description to be applied to the snapshot. required: false + type: str instance_id: description: - - instance that has the required volume to snapshot mounted + - Instance that has the required volume to snapshot mounted. required: false + type: str device_name: description: - - device name of a mounted volume to be snapshotted + - Device name of a mounted volume to be snapshotted. required: false + type: str snapshot_tags: description: - - a hash/dictionary of tags to add to the snapshot + - A dictionary of tags to add to the snapshot. + type: dict required: false version_added: "1.6" wait: description: - - wait for the snapshot to be ready + - Wait for the snapshot to be ready. type: bool required: false default: yes version_added: "1.5.1" wait_timeout: description: - - how long before wait gives up, in seconds - - specify 0 to wait forever + - How long before wait gives up, in seconds. + - Specify 0 to wait forever. required: false default: 0 version_added: "1.5.1" + type: int state: description: - - whether to add or create a snapshot + - Whether to add or create a snapshot. required: false default: present choices: ['absent', 'present'] version_added: "1.9" + type: str snapshot_id: description: - - snapshot id to remove + - Snapshot id to remove. required: false version_added: "1.9" + type: str last_snapshot_min_age: description: - If the volume's most recent snapshot has started less than `last_snapshot_min_age' minutes ago, a new snapshot will not be created. required: false default: 0 version_added: "2.0" + type: int author: "Will Thames (@willthames)" extends_documentation_fragment: diff --git a/lib/ansible/modules/cloud/amazon/ec2_snapshot_copy.py b/lib/ansible/modules/cloud/amazon/ec2_snapshot_copy.py index e55b59f353a..1746a6f2eee 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_snapshot_copy.py +++ b/lib/ansible/modules/cloud/amazon/ec2_snapshot_copy.py @@ -3,6 +3,9 @@ # Copyright: (c) 2017, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = { 'metadata_version': '1.1', 'status': ['preview'], @@ -13,7 +16,7 @@ ANSIBLE_METADATA = { DOCUMENTATION = ''' --- module: ec2_snapshot_copy -short_description: copies an EC2 snapshot and returns the new Snapshot ID. +short_description: Copies an EC2 snapshot and returns the new Snapshot ID. description: - Copies an EC2 Snapshot from a source region to a destination region. version_added: "2.4" @@ -22,13 +25,16 @@ options: description: - The source region the Snapshot should be copied from. required: true + type: str source_snapshot_id: description: - The ID of the Snapshot in source region that should be copied. required: true + type: str description: description: - An optional human-readable string describing purpose of the new Snapshot. + type: str encrypted: description: - Whether or not the destination Snapshot should be encrypted. @@ -36,7 +42,8 @@ options: default: 'no' kms_key_id: description: - - KMS key id used to encrypt snapshot. If not specified, defaults to EBS Customer Master Key (CMK) for that account. + - KMS key id used to encrypt snapshot. If not specified, AWS defaults to C(alias/aws/ebs). + type: str wait: description: - Wait for the copied Snapshot to be in 'Available' state before returning. @@ -47,9 +54,11 @@ options: description: - How long before wait gives up, in seconds. default: 600 + type: int tags: description: - A hash/dictionary of tags to add to the new Snapshot; '{"key":"value"}' and '{"key":"value","key":"value"}' + type: dict author: Deepak Kothandan (@Deepakkothandan) extends_documentation_fragment: - aws diff --git a/lib/ansible/modules/cloud/amazon/ec2_snapshot_info.py b/lib/ansible/modules/cloud/amazon/ec2_snapshot_info.py index 9b15c7ee3e2..e7f73dc2931 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_snapshot_info.py +++ b/lib/ansible/modules/cloud/amazon/ec2_snapshot_info.py @@ -16,7 +16,7 @@ DOCUMENTATION = ''' module: ec2_snapshot_info short_description: Gather information about ec2 volume snapshots in AWS description: - - Gather information about ec2 volume snapshots in AWS + - Gather information about ec2 volume snapshots in AWS. - This module was called C(ec2_snapshot_facts) before Ansible 2.9. The usage did not change. version_added: "2.1" requirements: [ boto3 ] @@ -27,24 +27,31 @@ options: - If you specify one or more snapshot IDs, only snapshots that have the specified IDs are returned. required: false default: [] + type: list + elements: str owner_ids: description: - If you specify one or more snapshot owners, only snapshots from the specified owners and for which you have \ access are returned. required: false default: [] + type: list + elements: str restorable_by_user_ids: description: - If you specify a list of restorable users, only snapshots with create snapshot permissions for those users are \ returned. required: false default: [] + type: list + elements: str filters: description: - A dict of filters to apply. Each dict item consists of a filter key and a filter value. See \ U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSnapshots.html) for possible filters. Filter \ names and values are case sensitive. required: false + type: dict default: {} notes: - By default, the module will return all snapshots, including public ones. To limit results to snapshots owned by \ diff --git a/lib/ansible/modules/cloud/amazon/ec2_tag.py b/lib/ansible/modules/cloud/amazon/ec2_tag.py index 3a2144b00d1..5aca5bdc5c8 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_tag.py +++ b/lib/ansible/modules/cloud/amazon/ec2_tag.py @@ -14,7 +14,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', DOCUMENTATION = ''' --- module: ec2_tag -short_description: create and remove tags on ec2 resources. +short_description: create and remove tags on ec2 resources description: - Creates, removes and lists tags for any EC2 resource. The resource is referenced by its resource id (e.g. an instance being i-XXXXXXX). It is designed to be used with complex args (tags), see the examples. @@ -25,20 +25,23 @@ options: description: - The EC2 resource id. required: true + type: str state: description: - Whether the tags should be present or absent on the resource. Use list to interrogate the tags of an instance. default: present choices: ['present', 'absent', 'list'] + type: str tags: description: - A dictionary of tags to add or remove from the resource. - - If the value provided for a tag is null and C(state) is I(absent), the tag will be removed regardless of its current value. + - If the value provided for a tag is null and I(state=absent), the tag will be removed regardless of its current value. required: true + type: dict purge_tags: description: - Whether unspecified tags should be removed from the resource. - - "Note that when combined with C(state: absent), specified tags with non-matching values are not purged." + - Note that when combined with I(state=absent), specified tags with non-matching values are not purged. type: bool default: no version_added: '2.7' diff --git a/lib/ansible/modules/cloud/amazon/ec2_transit_gateway.py b/lib/ansible/modules/cloud/amazon/ec2_transit_gateway.py index b08e7b19a41..d974bbd848e 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_transit_gateway.py +++ b/lib/ansible/modules/cloud/amazon/ec2_transit_gateway.py @@ -13,32 +13,33 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', DOCUMENTATION = ''' module: ec2_transit_gateway -short_description: Create and delete AWS Transit Gateways. +short_description: Create and delete AWS Transit Gateways description: - - Creates AWS Transit Gateways - - Deletes AWS Transit Gateways - - Updates tags on existing transit gateways + - Creates AWS Transit Gateways. + - Deletes AWS Transit Gateways. + - Updates tags on existing transit gateways. version_added: "2.8" requirements: [ 'botocore', 'boto3' ] options: asn: description: - A private Autonomous System Number (ASN) for the Amazon side of a BGP session. - The range is 64512 to 65534 for 16-bit ASNs and 4200000000 to 4294967294 for 32-bit ASNs. + - The range is 64512 to 65534 for 16-bit ASNs and 4200000000 to 4294967294 for 32-bit ASNs. + type: int auto_associate: description: - Enable or disable automatic association with the default association route table. - default: yes + default: true type: bool auto_attach: description: - Enable or disable automatic acceptance of attachment requests. - default: no + default: false type: bool auto_propagate: description: - Enable or disable automatic propagation of routes to the default propagation route table. - default: yes + default: true type: bool description: description: @@ -47,22 +48,24 @@ options: dns_support: description: - Whether to enable AWS DNS support. - default: yes + default: true type: bool purge_tags: description: - Whether to purge existing tags not included with tags argument. - default: yes + default: true type: bool state: description: - - present to ensure resource is created. - - absent to remove resource. + - C(present) to ensure resource is created. + - C(absent) to remove resource. default: present choices: [ "present", "absent"] + type: str tags: description: - A dictionary of resource tags + type: dict transit_gateway_id: description: - The ID of the transit gateway. @@ -70,16 +73,18 @@ options: vpn_ecmp_support: description: - Enable or disable Equal Cost Multipath Protocol support. - default: yes + default: true type: bool wait: description: - Whether to wait for status - default: yes + default: true + type: bool wait_timeout: description: - number of seconds to wait for status default: 300 + type: int author: "Bob Boldin (@BobBoldin)" extends_documentation_fragment: diff --git a/lib/ansible/modules/cloud/amazon/ec2_vol.py b/lib/ansible/modules/cloud/amazon/ec2_vol.py index d147fea54cd..e86105f9b66 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vol.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vol.py @@ -14,82 +14,95 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', DOCUMENTATION = ''' --- module: ec2_vol -short_description: create and attach a volume, return volume id and device map +short_description: Create and attach a volume, return volume id and device map description: - - creates an EBS volume and optionally attaches it to an instance. - If both an instance ID and a device name is given and the instance has a device at the device name, then no volume is created and no attachment is made. - This module has a dependency on python-boto. + - Creates an EBS volume and optionally attaches it to an instance. + - If both I(instance) and I(name) are given and the instance has a device at the device name, then no volume is created and no attachment is made. + - This module has a dependency on python-boto. version_added: "1.1" options: instance: description: - - instance ID if you wish to attach the volume. Since 1.9 you can set to None to detach. + - Instance ID if you wish to attach the volume. Since 1.9 you can set to None to detach. + type: str name: description: - - volume Name tag if you wish to attach an existing volume (requires instance) + - Volume Name tag if you wish to attach an existing volume (requires instance) version_added: "1.6" + type: str id: description: - - volume id if you wish to attach an existing volume (requires instance) or remove an existing volume + - Volume id if you wish to attach an existing volume (requires instance) or remove an existing volume version_added: "1.6" + type: str volume_size: description: - - size of volume (in GiB) to create. + - Size of volume (in GiB) to create. + type: int volume_type: description: - Type of EBS volume; standard (magnetic), gp2 (SSD), io1 (Provisioned IOPS), st1 (Throughput Optimized HDD), sc1 (Cold HDD). "Standard" is the old EBS default and continues to remain the Ansible default for backwards compatibility. default: standard version_added: "1.9" + choices: ['standard', 'gp2', 'io1', 'st1', 'sc1'] + type: str iops: description: - - the provisioned IOPs you want to associate with this volume (integer). - default: 100 + - The provisioned IOPs you want to associate with this volume (integer). + - By default AWS will set this to 100. version_added: "1.3" + type: int encrypted: description: - Enable encryption at rest for this volume. - default: 'no' + default: false type: bool version_added: "1.8" kms_key_id: description: - Specify the id of the KMS key to use. version_added: "2.3" + type: str device_name: description: - - device id to override device mapping. Assumes /dev/sdf for Linux/UNIX and /dev/xvdf for Windows. + - Device id to override device mapping. Assumes /dev/sdf for Linux/UNIX and /dev/xvdf for Windows. + type: str delete_on_termination: description: - - When set to "yes", the volume will be deleted upon instance termination. + - When set to C(true), the volume will be deleted upon instance termination. type: bool - default: 'no' + default: false version_added: "2.1" zone: description: - - zone in which to create the volume, if unset uses the zone the instance is in (if set) - aliases: ['aws_zone', 'ec2_zone'] + - Zone in which to create the volume, if unset uses the zone the instance is in (if set). + aliases: ['availability_zone', 'aws_zone', 'ec2_zone'] + type: str snapshot: description: - - snapshot ID on which to base the volume + - Snapshot ID on which to base the volume. version_added: "1.5" + type: str validate_certs: description: - When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. type: bool - default: 'yes' + default: true version_added: "1.5" state: description: - - whether to ensure the volume is present or absent, or to list existing volumes (The C(list) option was added in version 1.8). + - Whether to ensure the volume is present or absent, or to list existing volumes (The C(list) option was added in version 1.8). default: present choices: ['absent', 'present', 'list'] version_added: "1.6" + type: str tags: description: - - tag:value pairs to add to the volume after creation + - tag:value pairs to add to the volume after creation. default: {} version_added: "2.3" + type: dict author: "Lester Wade (@lwade)" extends_documentation_fragment: - aws @@ -491,9 +504,9 @@ def main(): instance=dict(), id=dict(), name=dict(), - volume_size=dict(), + volume_size=dict(type='int'), volume_type=dict(choices=['standard', 'gp2', 'io1', 'st1', 'sc1'], default='standard'), - iops=dict(), + iops=dict(type='int'), encrypted=dict(type='bool', default=False), kms_key_id=dict(), device_name=dict(), diff --git a/lib/ansible/modules/cloud/amazon/ec2_vol_info.py b/lib/ansible/modules/cloud/amazon/ec2_vol_info.py index 24aeda554d2..fecaab0904c 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vol_info.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vol_info.py @@ -16,16 +16,17 @@ DOCUMENTATION = ''' module: ec2_vol_info short_description: Gather information about ec2 volumes in AWS description: - - Gather information about ec2 volumes in AWS + - Gather information about ec2 volumes in AWS. - This module was called C(ec2_vol_facts) before Ansible 2.9. The usage did not change. version_added: "2.1" requirements: [ boto3 ] author: "Rob White (@wimnat)" options: filters: + type: dict description: - A dict of filters to apply. Each dict item consists of a filter key and a filter value. - See U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVolumes.html) for possible filters. + - See U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVolumes.html) for possible filters. extends_documentation_fragment: - aws - ec2 diff --git a/lib/ansible/modules/cloud/amazon/ec2_win_password.py b/lib/ansible/modules/cloud/amazon/ec2_win_password.py index a8139ed08b1..4cb0c5003de 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_win_password.py +++ b/lib/ansible/modules/cloud/amazon/ec2_win_password.py @@ -14,10 +14,10 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', DOCUMENTATION = ''' --- module: ec2_win_password -short_description: gets the default administrator password for ec2 windows instances +short_description: Gets the default administrator password for ec2 windows instances description: - - Gets the default administrator password from any EC2 Windows instance. The instance is referenced by its id (e.g. C(i-XXXXXXX)). This module - has a dependency on python-boto. + - Gets the default administrator password from any EC2 Windows instance. The instance is referenced by its id (e.g. C(i-XXXXXXX)). + - This module has a dependency on python-boto. version_added: "2.0" author: "Rick Mendes (@rickmendes)" options: @@ -25,31 +25,38 @@ options: description: - The instance id to get the password data from. required: true + type: str key_file: description: - - Path to the file containing the key pair used on the instance, conflicts with key_data. + - Path to the file containing the key pair used on the instance. + - Conflicts with I(key_data). required: false + type: path key_data: version_added: "2.8" description: - - Variable that references the private key (usually stored in vault), conflicts with key_file. + - The private key (usually stored in vault). + - Conflicts with I(key_file), required: false + type: str key_passphrase: version_added: "2.0" description: - 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) C(openssl rsa -in current_key -out new_key -des3). + type: str wait: version_added: "2.0" description: - Whether or not to wait for the password to be available before returning. type: bool - default: 'no' + default: false wait_timeout: version_added: "2.0" description: - Number of seconds to wait before giving up. default: 120 + type: int extends_documentation_fragment: - aws diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index fdfc3d146c7..0b07156fcce 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -489,113 +489,6 @@ lib/ansible/modules/cloud/alicloud/ali_instance.py validate-modules:parameter-ty lib/ansible/modules/cloud/alicloud/ali_instance.py validate-modules:doc-missing-type lib/ansible/modules/cloud/alicloud/ali_instance_info.py validate-modules:parameter-type-not-in-doc lib/ansible/modules/cloud/alicloud/ali_instance_info.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2.py validate-modules:undocumented-parameter -lib/ansible/modules/cloud/amazon/ec2.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_ami.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/cloud/amazon/ec2_ami.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_ami.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_ami_copy.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2_ami_copy.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2_ami_copy.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_ami_copy.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_ami_info.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2_ami_info.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2_ami_info.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_ami_info.py validate-modules:return-syntax-error -lib/ansible/modules/cloud/amazon/ec2_asg.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2_asg.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2_asg.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/cloud/amazon/ec2_asg.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/cloud/amazon/ec2_asg.py validate-modules:doc-default-incompatible-type -lib/ansible/modules/cloud/amazon/ec2_asg.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_asg.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_asg_info.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_asg_lifecycle_hook.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2_asg_lifecycle_hook.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2_asg_lifecycle_hook.py validate-modules:doc-default-incompatible-type -lib/ansible/modules/cloud/amazon/ec2_asg_lifecycle_hook.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_asg_lifecycle_hook.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_customer_gateway.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2_customer_gateway.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2_customer_gateway.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_customer_gateway.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_customer_gateway.py validate-modules:return-syntax-error -lib/ansible/modules/cloud/amazon/ec2_customer_gateway_info.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2_customer_gateway_info.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2_customer_gateway_info.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_eip.py validate-modules:undocumented-parameter -lib/ansible/modules/cloud/amazon/ec2_eip.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/cloud/amazon/ec2_eip.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_eip.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_eip_info.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2_eip_info.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2_eip_info.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_eni.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2_eni.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2_eni.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_eni.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_eni_info.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2_eni_info.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2_eni_info.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_group.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2_group.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2_group.py validate-modules:undocumented-parameter -lib/ansible/modules/cloud/amazon/ec2_group.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_group.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_group_info.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_key.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_key.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_launch_template.py validate-modules:nonexistent-parameter-documented -lib/ansible/modules/cloud/amazon/ec2_launch_template.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/cloud/amazon/ec2_launch_template.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_launch_template.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_lc.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2_lc.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2_lc.py validate-modules:undocumented-parameter -lib/ansible/modules/cloud/amazon/ec2_lc.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/cloud/amazon/ec2_lc.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/cloud/amazon/ec2_lc.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_lc.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_lc.py validate-modules:return-syntax-error -lib/ansible/modules/cloud/amazon/ec2_lc_find.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_lc_find.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_lc_info.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_lc_info.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py validate-modules:return-syntax-error -lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_placement_group.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2_placement_group.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2_placement_group.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_placement_group.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_placement_group_info.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2_placement_group_info.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2_placement_group_info.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_scaling_policy.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/cloud/amazon/ec2_scaling_policy.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_scaling_policy.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_snapshot.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_snapshot.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_snapshot_copy.py future-import-boilerplate -lib/ansible/modules/cloud/amazon/ec2_snapshot_copy.py metaclass-boilerplate -lib/ansible/modules/cloud/amazon/ec2_snapshot_copy.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_snapshot_copy.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_snapshot_info.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_tag.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_tag.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_transit_gateway.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_transit_gateway.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_vol.py validate-modules:undocumented-parameter -lib/ansible/modules/cloud/amazon/ec2_vol.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/cloud/amazon/ec2_vol.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/cloud/amazon/ec2_vol.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_vol.py validate-modules:doc-missing-type -lib/ansible/modules/cloud/amazon/ec2_vol_info.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_win_password.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/cloud/amazon/ec2_win_password.py validate-modules:doc-missing-type lib/ansible/modules/cloud/atomic/atomic_container.py validate-modules:no-default-for-required-parameter lib/ansible/modules/cloud/atomic/atomic_container.py validate-modules:parameter-type-not-in-doc lib/ansible/modules/cloud/atomic/atomic_container.py validate-modules:doc-missing-type