|
|
|
@ -20,8 +20,9 @@ version_added: "0.9"
|
|
|
|
|
options:
|
|
|
|
|
key_name:
|
|
|
|
|
description:
|
|
|
|
|
- key pair to use on the instance. The SSH key must exist on AWS in order to use this argument. If you want to generate keys from Ansible,
|
|
|
|
|
take a look at `ec2_key` module.
|
|
|
|
|
- Key pair to use on the instance.
|
|
|
|
|
- The SSH key must already exist in AWS in order to use this argument.
|
|
|
|
|
- Keys can be created / deleted using the M(ec2_key) module.
|
|
|
|
|
aliases: ['keypair']
|
|
|
|
|
type: str
|
|
|
|
|
id:
|
|
|
|
@ -36,19 +37,13 @@ options:
|
|
|
|
|
- Security group (or list of groups) to use with the instance.
|
|
|
|
|
aliases: [ 'groups' ]
|
|
|
|
|
type: list
|
|
|
|
|
elements: str
|
|
|
|
|
group_id:
|
|
|
|
|
version_added: "1.1"
|
|
|
|
|
description:
|
|
|
|
|
- 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 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
|
|
|
|
|
elements: str
|
|
|
|
|
zone:
|
|
|
|
|
version_added: "1.2"
|
|
|
|
|
description:
|
|
|
|
@ -58,13 +53,13 @@ options:
|
|
|
|
|
instance_type:
|
|
|
|
|
description:
|
|
|
|
|
- Instance type to use for the instance, see U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html).
|
|
|
|
|
required: true
|
|
|
|
|
- Required when creating a new instance.
|
|
|
|
|
type: str
|
|
|
|
|
aliases: ['type']
|
|
|
|
|
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.
|
|
|
|
|
- An instance with a tenancy of C(dedicated) runs on single-tenant hardware and can only be launched into a VPC.
|
|
|
|
|
- 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
|
|
|
|
@ -79,29 +74,30 @@ options:
|
|
|
|
|
spot_type:
|
|
|
|
|
version_added: "2.0"
|
|
|
|
|
description:
|
|
|
|
|
- Type of spot request; one of "one-time" or "persistent". Defaults to "one-time" if not supplied.
|
|
|
|
|
- The type of spot request.
|
|
|
|
|
- After being interrupted a C(persistent) spot instance will be started once there is capacity to fill the request again.
|
|
|
|
|
default: "one-time"
|
|
|
|
|
choices: [ "one-time", "persistent" ]
|
|
|
|
|
type: str
|
|
|
|
|
image:
|
|
|
|
|
description:
|
|
|
|
|
- I(ami) ID to use for the instance.
|
|
|
|
|
required: true
|
|
|
|
|
- Required when I(state=present).
|
|
|
|
|
type: str
|
|
|
|
|
kernel:
|
|
|
|
|
description:
|
|
|
|
|
- Kernel I(eki) to use for the instance.
|
|
|
|
|
- Kernel eki to use for the instance.
|
|
|
|
|
type: str
|
|
|
|
|
ramdisk:
|
|
|
|
|
description:
|
|
|
|
|
- Ramdisk I(eri) to use for the instance.
|
|
|
|
|
- Ramdisk 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.
|
|
|
|
|
- Does not wait for SSH, see the 'wait_for_connection' example for details.
|
|
|
|
|
type: bool
|
|
|
|
|
default: 'no'
|
|
|
|
|
default: false
|
|
|
|
|
wait_timeout:
|
|
|
|
|
description:
|
|
|
|
|
- How long before wait gives up, in seconds.
|
|
|
|
@ -123,7 +119,7 @@ options:
|
|
|
|
|
description:
|
|
|
|
|
- Enable detailed monitoring (CloudWatch) for instance.
|
|
|
|
|
type: bool
|
|
|
|
|
default: 'no'
|
|
|
|
|
default: false
|
|
|
|
|
user_data:
|
|
|
|
|
version_added: "0.9"
|
|
|
|
|
description:
|
|
|
|
@ -165,18 +161,19 @@ options:
|
|
|
|
|
- "list of instance ids, currently used for states: absent, running, stopped"
|
|
|
|
|
aliases: ['instance_id']
|
|
|
|
|
type: list
|
|
|
|
|
elements: str
|
|
|
|
|
source_dest_check:
|
|
|
|
|
version_added: "1.6"
|
|
|
|
|
description:
|
|
|
|
|
- Enable or Disable the Source/Destination checks (for NAT instances and Virtual Routers).
|
|
|
|
|
When initially creating an instance the EC2 API defaults this to True.
|
|
|
|
|
When initially creating an instance the EC2 API defaults this to C(True).
|
|
|
|
|
type: bool
|
|
|
|
|
termination_protection:
|
|
|
|
|
version_added: "2.0"
|
|
|
|
|
description:
|
|
|
|
|
- Enable or Disable the Termination Protection.
|
|
|
|
|
type: bool
|
|
|
|
|
default: 'no'
|
|
|
|
|
default: false
|
|
|
|
|
instance_initiated_shutdown_behavior:
|
|
|
|
|
version_added: "2.2"
|
|
|
|
|
description:
|
|
|
|
@ -189,24 +186,63 @@ options:
|
|
|
|
|
version_added: "1.3"
|
|
|
|
|
description:
|
|
|
|
|
- Create, terminate, start, stop or restart instances. The state 'restarted' was added in Ansible 2.2.
|
|
|
|
|
- When 'absent', I(instance_ids) is required.
|
|
|
|
|
- When 'running', 'stopped' and 'restarted', I(instance_ids) or I(instance_tags) is required.
|
|
|
|
|
- When I(state=absent), I(instance_ids) is required.
|
|
|
|
|
- When I(state=running), I(state=stopped) or I(state=restarted) then either I(instance_ids) or I(instance_tags) is required.
|
|
|
|
|
default: 'present'
|
|
|
|
|
choices: ['absent', 'present', 'restarted', 'running', 'stopped']
|
|
|
|
|
type: str
|
|
|
|
|
volumes:
|
|
|
|
|
version_added: "1.5"
|
|
|
|
|
description:
|
|
|
|
|
- a list of hash/dictionaries of volumes to add to the new instance; '[{"key":"value", "key":"value"}]'; keys allowed
|
|
|
|
|
are - device_name (str; required), delete_on_termination (bool; False), ephemeral (str),
|
|
|
|
|
encrypted (bool; False), snapshot (str), volume_type (str), volume_size (int, GiB), iops (int) - iops must be set when
|
|
|
|
|
volume_type='io1', ephemeral and snapshot are mutually exclusive.
|
|
|
|
|
- A list of hash/dictionaries of volumes to add to the new instance.
|
|
|
|
|
type: list
|
|
|
|
|
elements: dict
|
|
|
|
|
suboptions:
|
|
|
|
|
device_name:
|
|
|
|
|
type: str
|
|
|
|
|
required: true
|
|
|
|
|
description:
|
|
|
|
|
- A name for the device (For example C(/dev/sda)).
|
|
|
|
|
delete_on_termination:
|
|
|
|
|
type: bool
|
|
|
|
|
default: false
|
|
|
|
|
description:
|
|
|
|
|
- Whether the volume should be automatically deleted when the instance is terminated.
|
|
|
|
|
ephemeral:
|
|
|
|
|
type: str
|
|
|
|
|
description:
|
|
|
|
|
- Whether the volume should be ephemeral.
|
|
|
|
|
- Data on ephemeral volumes is lost when the instance is stopped.
|
|
|
|
|
- Mutually exclusive with the I(snapshot) parameter.
|
|
|
|
|
encrypted:
|
|
|
|
|
type: bool
|
|
|
|
|
default: false
|
|
|
|
|
description:
|
|
|
|
|
- Whether the volume should be encrypted using the 'aws/ebs' KMS CMK.
|
|
|
|
|
snapshot:
|
|
|
|
|
type: str
|
|
|
|
|
description:
|
|
|
|
|
- The ID of an EBS snapshot to copy when creating the volume.
|
|
|
|
|
- Mutually exclusive with the I(ephemeral) parameter.
|
|
|
|
|
volume_type:
|
|
|
|
|
type: str
|
|
|
|
|
description:
|
|
|
|
|
- The type of volume to create.
|
|
|
|
|
- See U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) for more information on the available volume types.
|
|
|
|
|
volume_size:
|
|
|
|
|
type: int
|
|
|
|
|
description:
|
|
|
|
|
- The size of the volume (in GiB).
|
|
|
|
|
iops:
|
|
|
|
|
type: int
|
|
|
|
|
description:
|
|
|
|
|
- The number of IOPS per second to provision for the volume.
|
|
|
|
|
- Required when I(volume_type=io1).
|
|
|
|
|
ebs_optimized:
|
|
|
|
|
version_added: "1.6"
|
|
|
|
|
description:
|
|
|
|
|
- whether instance is using optimized EBS volumes, see U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
|
|
|
|
|
default: 'no'
|
|
|
|
|
- Whether instance is using optimized EBS volumes, see U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
|
|
|
|
|
default: false
|
|
|
|
|
type: bool
|
|
|
|
|
exact_count:
|
|
|
|
|
version_added: "1.5"
|
|
|
|
@ -217,28 +253,31 @@ options:
|
|
|
|
|
count_tag:
|
|
|
|
|
version_added: "1.5"
|
|
|
|
|
description:
|
|
|
|
|
- Used with 'exact_count' to determine how many nodes based on a specific tag criteria should be running.
|
|
|
|
|
- Used with I(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.
|
|
|
|
|
that are tagged with "class=webserver". The specified tag must already exist or be passed in as the I(instance_tags) option.
|
|
|
|
|
type: raw
|
|
|
|
|
network_interfaces:
|
|
|
|
|
version_added: "2.0"
|
|
|
|
|
description:
|
|
|
|
|
- A list of existing network interfaces to attach to the instance at launch. When specifying existing network interfaces,
|
|
|
|
|
none of the assign_public_ip, private_ip, vpc_subnet_id, group, or group_id parameters may be used. (Those parameters are
|
|
|
|
|
none of the I(assign_public_ip), I(private_ip), I(vpc_subnet_id), I(group), or I(group_id) parameters may be used. (Those parameters are
|
|
|
|
|
for creating a new network interface at launch.)
|
|
|
|
|
aliases: ['network_interface']
|
|
|
|
|
type: list
|
|
|
|
|
elements: str
|
|
|
|
|
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).
|
|
|
|
|
- Launch group for spot requests, 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)"
|
|
|
|
|
- "Seth Vidal (@skvidal)"
|
|
|
|
|
extends_documentation_fragment: aws
|
|
|
|
|
extends_documentation_fragment:
|
|
|
|
|
- aws
|
|
|
|
|
- ec2
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
|