From d241fc7844d6bae1d8040025269055c726f369cf Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Fri, 22 Mar 2019 20:08:24 +0530 Subject: [PATCH] ec2: Fix documentation (#54081) Signed-off-by: Abhijeet Kasurde --- lib/ansible/modules/cloud/amazon/ec2.py | 84 +++++++++++++++++-------- 1 file changed, 57 insertions(+), 27 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2.py b/lib/ansible/modules/cloud/amazon/ec2.py index dc8532f139a..2a59b7e5c1c 100644 --- a/lib/ansible/modules/cloud/amazon/ec2.py +++ b/lib/ansible/modules/cloud/amazon/ec2.py @@ -29,124 +29,149 @@ version_added: "0.9" options: key_name: description: - - key pair to use on the instance + - Key pair to use on the instance. aliases: ['keypair'] + type: str id: version_added: "1.1" description: - - identifier for this instance or set of instances, so that the module will be idempotent with respect to EC2 instances. - This identifier is valid for at least 24 hours after the termination of the instance, and should not be reused for another call later on. - For details, see the description of client token at U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). + - Identifier for this instance or set of instances, so that the module will be idempotent with respect to EC2 instances. + - This identifier is valid for at least 24 hours after the termination of the instance, and should not be reused for another call later on. + - For details, see the description of client token at U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html). + type: str group: description: - - security group (or list of groups) to use with the instance. + - Security group (or list of groups) to use with the instance. aliases: [ 'groups' ] + type: list group_id: version_added: "1.1" description: - - security group id (or list of ids) to use with the instance. + - Security group id (or list of ids) to use with the instance. + type: list region: version_added: "1.2" description: - The AWS region to use. Must be specified if ec2_url is not used. - If not specified then the value of the AWS_REGION or EC2_REGION environment variable, if any, is used. - See U(https://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region). + - If not specified then the value of the C(AWS_REGION) or C(EC2_REGION) environment variable, if any, is used. + - See U(https://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region). aliases: [ 'aws_region', 'ec2_region' ] + type: str zone: version_added: "1.2" description: - AWS availability zone in which to launch the instance. aliases: [ 'aws_zone', 'ec2_zone' ] + type: str instance_type: description: - - instance type to use for the instance, see U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html). + - Instance type to use for the instance, see U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html). required: true + type: str tenancy: version_added: "1.9" description: - An instance with a tenancy of "dedicated" runs on single-tenant hardware and can only be launched into a VPC. - Note that to use dedicated tenancy you MUST specify a vpc_subnet_id as well. Dedicated tenancy is not available for EC2 "micro" instances. + - Note that to use dedicated tenancy you MUST specify a I(vpc_subnet_id) as well. + - Dedicated tenancy is not available for EC2 "micro" instances. default: default choices: [ "default", "dedicated" ] + type: str spot_price: version_added: "1.5" description: - - Maximum spot price to bid, If not set a regular on-demand instance is requested. A spot request is made with this maximum bid. - When it is filled, the instance is started. + - Maximum spot price to bid. If not set, a regular on-demand instance is requested. + - A spot request is made with this maximum bid. When it is filled, the instance is started. + type: str spot_type: version_added: "2.0" description: - Type of spot request; one of "one-time" or "persistent". Defaults to "one-time" if not supplied. default: "one-time" choices: [ "one-time", "persistent" ] + type: str image: description: - I(ami) ID to use for the instance. required: true + type: str kernel: description: - - kernel I(eki) to use for the instance. + - Kernel I(eki) to use for the instance. + type: str ramdisk: description: - - ramdisk I(eri) to use for the instance. + - Ramdisk I(eri) to use for the instance. + type: str wait: description: - - wait for the instance to reach its desired state before returning. Does not wait for SSH, see 'wait_for_connection' example for details. + - Wait for the instance to reach its desired state before returning. + - Does not wait for SSH, see 'wait_for_connection' example for details. type: bool default: 'no' wait_timeout: description: - - how long before wait gives up, in seconds. + - How long before wait gives up, in seconds. default: 300 + type: int spot_wait_timeout: version_added: "1.5" description: - - how long to wait for the spot instance request to be fulfilled. + - How long to wait for the spot instance request to be fulfilled. default: 600 + type: int count: description: - - number of instances to launch. + - Number of instances to launch. default: 1 + type: int monitoring: version_added: "1.1" description: - - enable detailed monitoring (CloudWatch) for instance. + - Enable detailed monitoring (CloudWatch) for instance. type: bool default: 'no' user_data: version_added: "0.9" description: - - opaque blob of data which is made available to the ec2 instance. + - Opaque blob of data which is made available to the EC2 instance. + type: str instance_tags: version_added: "1.0" description: - - a hash/dictionary of tags to add to the new instance or for starting/stopping instance by tag; '{"key":"value"}' and '{"key":"value","key":"value"}'. + - A hash/dictionary of tags to add to the new instance or for starting/stopping instance by tag; '{"key":"value"}' and '{"key":"value","key":"value"}'. + type: dict placement_group: version_added: "1.3" description: - - placement group for the instance when using EC2 Clustered Compute. + - Placement group for the instance when using EC2 Clustered Compute. + type: str vpc_subnet_id: version_added: "1.1" description: - the subnet ID in which to launch the instance (VPC). + type: str assign_public_ip: version_added: "1.5" description: - - when provisioning within vpc, assign a public IP address. Boto library must be 2.13.0+. + - When provisioning within vpc, assign a public IP address. Boto library must be 2.13.0+. type: bool private_ip: version_added: "1.2" description: - - the private ip address to assign the instance (from the vpc subnet). + - The private ip address to assign the instance (from the vpc subnet). + type: str instance_profile_name: version_added: "1.3" description: - Name of the IAM instance profile (i.e. what the EC2 console refers to as an "IAM Role") to use. Boto library must be 2.5.0+. + type: str instance_ids: version_added: "1.3" description: - "list of instance ids, currently used for states: absent, running, stopped" aliases: ['instance_id'] + type: list source_dest_check: version_added: "1.6" description: @@ -166,6 +191,7 @@ options: images (which require termination on shutdown). default: 'stop' choices: [ "stop", "terminate" ] + type: str state: version_added: "1.3" description: @@ -174,6 +200,7 @@ options: required: false default: 'present' choices: ['present', 'absent', 'running', 'restarted', 'stopped'] + type: str volumes: version_added: "1.5" description: @@ -181,6 +208,7 @@ options: are - device_name (str; required), delete_on_termination (bool; False), device_type (deprecated), ephemeral (str), encrypted (bool; False), snapshot (str), volume_type (str), volume_size (int, GiB), iops (int) - device_type is deprecated use volume_type, iops must be set when volume_type='io1', ephemeral and snapshot are mutually exclusive. + type: list ebs_optimized: version_added: "1.6" description: @@ -192,6 +220,7 @@ options: description: - An integer value which indicates how many instances that match the 'count_tag' parameter should be running. Instances are either created or terminated based on this value. + type: int count_tag: version_added: "1.5" description: @@ -205,11 +234,12 @@ options: none of the assign_public_ip, private_ip, vpc_subnet_id, group, or group_id parameters may be used. (Those parameters are for creating a new network interface at launch.) aliases: ['network_interface'] + type: list spot_launch_group: version_added: "2.1" description: - Launch group for spot request, see U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/how-spot-instances-work.html#spot-launch-group). - + type: str author: - "Tim Gerla (@tgerla)" - "Lester Wade (@lwade)" @@ -1596,8 +1626,8 @@ def main(): monitoring=dict(type='bool', default=False), ramdisk=dict(), wait=dict(type='bool', default=False), - wait_timeout=dict(default=300), - spot_wait_timeout=dict(default=600), + wait_timeout=dict(type='int', default=300), + spot_wait_timeout=dict(type='int', default=600), placement_group=dict(), user_data=dict(), instance_tags=dict(type='dict'),