|
|
@ -20,8 +20,9 @@ version_added: "0.9"
|
|
|
|
options:
|
|
|
|
options:
|
|
|
|
key_name:
|
|
|
|
key_name:
|
|
|
|
description:
|
|
|
|
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,
|
|
|
|
- Key pair to use on the instance.
|
|
|
|
take a look at `ec2_key` module.
|
|
|
|
- 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']
|
|
|
|
aliases: ['keypair']
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
id:
|
|
|
|
id:
|
|
|
@ -36,19 +37,13 @@ options:
|
|
|
|
- Security group (or list of groups) to use with the instance.
|
|
|
|
- Security group (or list of groups) to use with the instance.
|
|
|
|
aliases: [ 'groups' ]
|
|
|
|
aliases: [ 'groups' ]
|
|
|
|
type: list
|
|
|
|
type: list
|
|
|
|
|
|
|
|
elements: str
|
|
|
|
group_id:
|
|
|
|
group_id:
|
|
|
|
version_added: "1.1"
|
|
|
|
version_added: "1.1"
|
|
|
|
description:
|
|
|
|
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
|
|
|
|
type: list
|
|
|
|
region:
|
|
|
|
elements: str
|
|
|
|
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
|
|
|
|
|
|
|
|
zone:
|
|
|
|
zone:
|
|
|
|
version_added: "1.2"
|
|
|
|
version_added: "1.2"
|
|
|
|
description:
|
|
|
|
description:
|
|
|
@ -58,13 +53,13 @@ options:
|
|
|
|
instance_type:
|
|
|
|
instance_type:
|
|
|
|
description:
|
|
|
|
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
|
|
|
|
- Required when creating a new instance.
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
aliases: ['type']
|
|
|
|
aliases: ['type']
|
|
|
|
tenancy:
|
|
|
|
tenancy:
|
|
|
|
version_added: "1.9"
|
|
|
|
version_added: "1.9"
|
|
|
|
description:
|
|
|
|
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.
|
|
|
|
- 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.
|
|
|
|
- Dedicated tenancy is not available for EC2 "micro" instances.
|
|
|
|
default: default
|
|
|
|
default: default
|
|
|
@ -79,29 +74,30 @@ options:
|
|
|
|
spot_type:
|
|
|
|
spot_type:
|
|
|
|
version_added: "2.0"
|
|
|
|
version_added: "2.0"
|
|
|
|
description:
|
|
|
|
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"
|
|
|
|
default: "one-time"
|
|
|
|
choices: [ "one-time", "persistent" ]
|
|
|
|
choices: [ "one-time", "persistent" ]
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
image:
|
|
|
|
image:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- I(ami) ID to use for the instance.
|
|
|
|
- I(ami) ID to use for the instance.
|
|
|
|
required: true
|
|
|
|
- Required when I(state=present).
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
kernel:
|
|
|
|
kernel:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Kernel I(eki) to use for the instance.
|
|
|
|
- Kernel eki to use for the instance.
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
ramdisk:
|
|
|
|
ramdisk:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Ramdisk I(eri) to use for the instance.
|
|
|
|
- Ramdisk eri to use for the instance.
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
wait:
|
|
|
|
wait:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Wait for the instance to reach its desired state before returning.
|
|
|
|
- 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
|
|
|
|
type: bool
|
|
|
|
default: 'no'
|
|
|
|
default: false
|
|
|
|
wait_timeout:
|
|
|
|
wait_timeout:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- How long before wait gives up, in seconds.
|
|
|
|
- How long before wait gives up, in seconds.
|
|
|
@ -123,7 +119,7 @@ options:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Enable detailed monitoring (CloudWatch) for instance.
|
|
|
|
- Enable detailed monitoring (CloudWatch) for instance.
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
|
default: 'no'
|
|
|
|
default: false
|
|
|
|
user_data:
|
|
|
|
user_data:
|
|
|
|
version_added: "0.9"
|
|
|
|
version_added: "0.9"
|
|
|
|
description:
|
|
|
|
description:
|
|
|
@ -165,18 +161,19 @@ options:
|
|
|
|
- "list of instance ids, currently used for states: absent, running, stopped"
|
|
|
|
- "list of instance ids, currently used for states: absent, running, stopped"
|
|
|
|
aliases: ['instance_id']
|
|
|
|
aliases: ['instance_id']
|
|
|
|
type: list
|
|
|
|
type: list
|
|
|
|
|
|
|
|
elements: str
|
|
|
|
source_dest_check:
|
|
|
|
source_dest_check:
|
|
|
|
version_added: "1.6"
|
|
|
|
version_added: "1.6"
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Enable or Disable the Source/Destination checks (for NAT instances and Virtual Routers).
|
|
|
|
- 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
|
|
|
|
type: bool
|
|
|
|
termination_protection:
|
|
|
|
termination_protection:
|
|
|
|
version_added: "2.0"
|
|
|
|
version_added: "2.0"
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Enable or Disable the Termination Protection.
|
|
|
|
- Enable or Disable the Termination Protection.
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
|
default: 'no'
|
|
|
|
default: false
|
|
|
|
instance_initiated_shutdown_behavior:
|
|
|
|
instance_initiated_shutdown_behavior:
|
|
|
|
version_added: "2.2"
|
|
|
|
version_added: "2.2"
|
|
|
|
description:
|
|
|
|
description:
|
|
|
@ -189,24 +186,63 @@ options:
|
|
|
|
version_added: "1.3"
|
|
|
|
version_added: "1.3"
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Create, terminate, start, stop or restart instances. The state 'restarted' was added in Ansible 2.2.
|
|
|
|
- Create, terminate, start, stop or restart instances. The state 'restarted' was added in Ansible 2.2.
|
|
|
|
- When 'absent', I(instance_ids) is required.
|
|
|
|
- When I(state=absent), I(instance_ids) is required.
|
|
|
|
- When 'running', 'stopped' and 'restarted', I(instance_ids) or I(instance_tags) 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'
|
|
|
|
default: 'present'
|
|
|
|
choices: ['absent', 'present', 'restarted', 'running', 'stopped']
|
|
|
|
choices: ['absent', 'present', 'restarted', 'running', 'stopped']
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
volumes:
|
|
|
|
volumes:
|
|
|
|
version_added: "1.5"
|
|
|
|
version_added: "1.5"
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- a list of hash/dictionaries of volumes to add to the new instance; '[{"key":"value", "key":"value"}]'; keys allowed
|
|
|
|
- A list of hash/dictionaries of volumes to add to the new instance.
|
|
|
|
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.
|
|
|
|
|
|
|
|
type: list
|
|
|
|
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:
|
|
|
|
ebs_optimized:
|
|
|
|
version_added: "1.6"
|
|
|
|
version_added: "1.6"
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- whether instance is using optimized EBS volumes, see U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
|
|
|
|
- Whether instance is using optimized EBS volumes, see U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
|
|
|
|
default: 'no'
|
|
|
|
default: false
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
|
exact_count:
|
|
|
|
exact_count:
|
|
|
|
version_added: "1.5"
|
|
|
|
version_added: "1.5"
|
|
|
@ -217,28 +253,31 @@ options:
|
|
|
|
count_tag:
|
|
|
|
count_tag:
|
|
|
|
version_added: "1.5"
|
|
|
|
version_added: "1.5"
|
|
|
|
description:
|
|
|
|
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
|
|
|
|
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
|
|
|
|
type: raw
|
|
|
|
network_interfaces:
|
|
|
|
network_interfaces:
|
|
|
|
version_added: "2.0"
|
|
|
|
version_added: "2.0"
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- A list of existing network interfaces to attach to the instance at launch. When specifying existing network interfaces,
|
|
|
|
- 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.)
|
|
|
|
for creating a new network interface at launch.)
|
|
|
|
aliases: ['network_interface']
|
|
|
|
aliases: ['network_interface']
|
|
|
|
type: list
|
|
|
|
type: list
|
|
|
|
|
|
|
|
elements: str
|
|
|
|
spot_launch_group:
|
|
|
|
spot_launch_group:
|
|
|
|
version_added: "2.1"
|
|
|
|
version_added: "2.1"
|
|
|
|
description:
|
|
|
|
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
|
|
|
|
type: str
|
|
|
|
author:
|
|
|
|
author:
|
|
|
|
- "Tim Gerla (@tgerla)"
|
|
|
|
- "Tim Gerla (@tgerla)"
|
|
|
|
- "Lester Wade (@lwade)"
|
|
|
|
- "Lester Wade (@lwade)"
|
|
|
|
- "Seth Vidal (@skvidal)"
|
|
|
|
- "Seth Vidal (@skvidal)"
|
|
|
|
extends_documentation_fragment: aws
|
|
|
|
extends_documentation_fragment:
|
|
|
|
|
|
|
|
- aws
|
|
|
|
|
|
|
|
- ec2
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
EXAMPLES = '''
|
|
|
|