Class: Ansible::Ruby::Modules::Ec2_instance

Inherits:
Base show all
Defined in:
lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb

Overview

Create and manage AWS EC2 instance

Instance Method Summary collapse

Methods inherited from Base

#ansible_name, #to_h

Methods inherited from Ansible::Ruby::Models::Base

attr_option, attr_options, attribute, fix_inclusion, #initialize, remove_existing_validations, #to_h, validates

Constructor Details

This class inherits a constructor from Ansible::Ruby::Models::Base

Instance Method Details

#availability_zoneObject?

Returns Specify an availability zone to use the default subnet it. Useful if not specifying the I(vpc_subnet_id) parameter.,If no subnet, ENI, or availability zone is provided, the default subnet in the default VPC will be used in the first AZ (alphabetically sorted).

Returns:

  • (Object, nil)

    Specify an availability zone to use the default subnet it. Useful if not specifying the I(vpc_subnet_id) parameter.,If no subnet, ENI, or availability zone is provided, the default subnet in the default VPC will be used in the first AZ (alphabetically sorted).



83
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 83

attribute :availability_zone

#cpu_credit_specification:unlimited, ...

Returns For T2 series instances, choose whether to allow increased charges to buy CPU credits if the default pool is depleted.,Choose I(unlimited) to enable buying additional CPU credits.

Returns:

  • (:unlimited, :standard, nil)

    For T2 series instances, choose whether to allow increased charges to buy CPU credits if the default pool is depleted.,Choose I(unlimited) to enable buying additional CPU credits.



97
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 97

attribute :cpu_credit_specification

#cpu_optionsObject?

Returns Reduce the number of vCPU exposed to the instance.,Those parameters can only be set at instance launch. The two suboptions threads_per_core and core_count are mandatory.,See U(docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) for combinations available.,Requires botocore >= 1.10.16.

Returns:



101
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 101

attribute :cpu_options

#detailed_monitoringObject?

Returns Whether to allow detailed cloudwatch metrics to be collected, enabling more detailed alerting.

Returns:

  • (Object, nil)

    Whether to allow detailed cloudwatch metrics to be collected, enabling more detailed alerting.



104
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 104

attribute :detailed_monitoring

#ebs_optimizedObject?

Returns Whether instance is should use optimized EBS volumes, see U(docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).

Returns:



107
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 107

attribute :ebs_optimized

#filtersArray<String>, ...

Returns A dict of filters to apply when deciding whether existing instances match and should be altered. Each dict item consists of a filter key and a filter value. See U(docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html) for possible filters. Filter names and values are case sensitive. By default, instances are filtered for counting by their “Name” tag, base AMI, state (running, by default), and subnet ID. Any queryable filter can be used. Good candidates are specific tags, SSH keys, or security groups.

Returns:

  • (Array<String>, String, nil)

    A dict of filters to apply when deciding whether existing instances match and should be altered. Each dict item consists of a filter key and a filter value. See U(docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html) for possible filters. Filter names and values are case sensitive. By default, instances are filtered for counting by their “Name” tag, base AMI, state (running, by default), and subnet ID. Any queryable filter can be used. Good candidates are specific tags, SSH keys, or security groups.



110
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 110

attribute :filters

#imageObject?

Returns An image to use for the instance. The ec2_ami_facts module may be used to retrieve images. One of I(image) or I(image_id) are required when instance is not already present.,Complex object containing I(image.id), I(image.ramdisk), and I(image.kernel).,I(image.id) is the AMI ID.,I(image.ramdisk) overrides the AMI’s default ramdisk ID.,I(image.kernel) is a string AKI to override the AMI kernel.

Returns:

  • (Object, nil)

    An image to use for the instance. The ec2_ami_facts module may be used to retrieve images. One of I(image) or I(image_id) are required when instance is not already present.,Complex object containing I(image.id), I(image.ramdisk), and I(image.kernel).,I(image.id) is the AMI ID.,I(image.ramdisk) overrides the AMI’s default ramdisk ID.,I(image.kernel) is a string AKI to override the AMI kernel.



47
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 47

attribute :image

#image_idString?

Returns I(ami) ID to use for the instance. One of I(image) or I(image_id) are required when instance is not already present.,This is an alias for I(image.id).

Returns:

  • (String, nil)

    I(ami) ID to use for the instance. One of I(image) or I(image_id) are required when instance is not already present.,This is an alias for I(image.id).



50
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 50

attribute :image_id

#instance_idsArray<String>, ...

Returns If you specify one or more instance IDs, only instances that have the specified IDs are returned.

Returns:

  • (Array<String>, String, nil)

    If you specify one or more instance IDs, only instances that have the specified IDs are returned.



12
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 12

attribute :instance_ids

#instance_initiated_shutdown_behavior:stop, ...

Returns Whether to stop or terminate an instance upon shutdown.

Returns:

  • (:stop, :terminate, nil)

    Whether to stop or terminate an instance upon shutdown.



86
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 86

attribute :instance_initiated_shutdown_behavior

#instance_roleObject?

Returns The ARN or name of an EC2-enabled instance role to be used. If a name is not provided in arn format then the ListInstanceProfiles permission must also be granted. U(docs.aws.amazon.com/IAM/latest/APIReference/API_ListInstanceProfiles.html) If no full ARN is provided, the role with a matching name will be used from the active AWS account.

Returns:



114
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 114

attribute :instance_role

#instance_typeString?

Returns Instance type to use for the instance, see U(docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) Only required when instance is not already present.

Returns:



28
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 28

attribute :instance_type

#key_nameString?

Returns Name of the SSH access key to assign to the instance - must exist in the region the instance is created.

Returns:

  • (String, nil)

    Name of the SSH access key to assign to the instance - must exist in the region the instance is created.



79
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 79

attribute :key_name

#launch_templateObject?

Returns The EC2 launch template to base instance configuration on.,I(launch_template.id) the ID or the launch template (optional if name is specified),I(launch_template.name) the pretty name of the launch template (optional if id is specified),I(launch_template.version) the specific version of the launch template to use. If unspecified, the template default is chosen.

Returns:

  • (Object, nil)

    The EC2 launch template to base instance configuration on.,I(launch_template.id) the ID or the launch template (optional if name is specified),I(launch_template.name) the pretty name of the launch template (optional if id is specified),I(launch_template.version) the specific version of the launch template to use. If unspecified, the template default is chosen.



76
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 76

attribute :launch_template

#nameString?

Returns The Name tag for the instance.

Returns:

  • (String, nil)

    The Name tag for the instance.



61
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 61

attribute :name

#networkHash?

Returns Either a dictionary containing the key ‘interfaces’ corresponding to a list of network interface IDs or containing specifications for a single network interface.,If specifications for a single network are given, accepted keys are assign_public_ip (bool), private_ip_address (str), ipv6_addresses (list), source_dest_check (bool), description (str), delete_on_termination (bool), device_index (int), groups (list of security group IDs), private_ip_addresses (list), subnet_id (str).,I(network.interfaces) should be a list of ENI IDs (strings) or a list of objects containing the key I(id).,Use the ec2_eni to create ENIs with special settings.

Returns:

  • (Hash, nil)

    Either a dictionary containing the key ‘interfaces’ corresponding to a list of network interface IDs or containing specifications for a single network interface.,If specifications for a single network are given, accepted keys are assign_public_ip (bool), private_ip_address (str), ipv6_addresses (list), source_dest_check (bool), description (str), delete_on_termination (bool), device_index (int), groups (list of security group IDs), private_ip_addresses (list), subnet_id (str).,I(network.interfaces) should be a list of ENI IDs (strings) or a list of objects containing the key I(id).,Use the ec2_eni to create ENIs with special settings.



69
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 69

attribute :network

#purge_tagsBoolean?

Returns Delete any tags not specified in the task that are on the instance. This means you have to specify all the desired tags on each task affecting an instance.

Returns:

  • (Boolean, nil)

    Delete any tags not specified in the task that are on the instance. This means you have to specify all the desired tags on each task affecting an instance.



43
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 43

attribute :purge_tags

#security_groupString?

Returns A security group ID or name. Mutually exclusive with I(security_groups).

Returns:

  • (String, nil)

    A security group ID or name. Mutually exclusive with I(security_groups).



57
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 57

attribute :security_group

#security_groupsObject?

Returns A list of security group IDs or names (strings). Mutually exclusive with I(security_group).

Returns:

  • (Object, nil)

    A list of security group IDs or names (strings). Mutually exclusive with I(security_group).



54
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 54

attribute :security_groups

#state:present, ...

Returns Goal state for the instances.

Returns:

  • (:present, :terminated, :running, :started, :stopped, :restarted, :rebooted, :absent, nil)

    Goal state for the instances



16
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 16

attribute :state

#tagsHash?

Returns A hash/dictionary of tags to add to the new instance or to add/remove from an existing one.

Returns:

  • (Hash, nil)

    A hash/dictionary of tags to add to the new instance or to add/remove from an existing one.



39
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 39

attribute :tags

#tenancy:dedicated, ...

Returns What type of tenancy to allow an instance to use. Default is shared tenancy. Dedicated tenancy will incur additional charges.

Returns:

  • (:dedicated, :default, nil)

    What type of tenancy to allow an instance to use. Default is shared tenancy. Dedicated tenancy will incur additional charges.



90
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 90

attribute :tenancy

#termination_protectionObject?

Returns Whether to enable termination protection. This module will not terminate an instance with termination protection active, it must be turned off first.

Returns:

  • (Object, nil)

    Whether to enable termination protection. This module will not terminate an instance with termination protection active, it must be turned off first.



94
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 94

attribute :termination_protection

#tower_callbackHash?

Returns Preconfigured user-data to enable an instance to perform a Tower callback (Linux only).,Mutually exclusive with I(user_data).,For Windows instances, to enable remote access via Ansible set I(tower_callback.windows) to true, and optionally set an admin password.,If using ‘windows’ and ‘set_password’, callback to Tower will not be performed but the instance will be ready to receive winrm connections from Ansible.

Returns:

  • (Hash, nil)

    Preconfigured user-data to enable an instance to perform a Tower callback (Linux only).,Mutually exclusive with I(user_data).,For Windows instances, to enable remote access via Ansible set I(tower_callback.windows) to true, and optionally set an admin password.,If using ‘windows’ and ‘set_password’, callback to Tower will not be performed but the instance will be ready to receive winrm connections from Ansible.



35
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 35

attribute :tower_callback

#user_dataObject?

Returns Opaque blob of data which is made available to the ec2 instance.

Returns:

  • (Object, nil)

    Opaque blob of data which is made available to the ec2 instance



32
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 32

attribute :user_data

#volumesObject?

Returns A list of block device mappings, by default this will always use the AMI root device so the volumes option is primarily for adding more storage.,A mapping contains the (optional) keys device_name, virtual_name, ebs.volume_type, ebs.volume_size, ebs.kms_key_id, ebs.iops, and ebs.delete_on_termination.,For more information about each parameter, see U(docs.aws.amazon.com/AWSEC2/latest/APIReference/API_BlockDeviceMapping.html).

Returns:

  • (Object, nil)

    A list of block device mappings, by default this will always use the AMI root device so the volumes option is primarily for adding more storage.,A mapping contains the (optional) keys device_name, virtual_name, ebs.volume_type, ebs.volume_size, ebs.kms_key_id, ebs.iops, and ebs.delete_on_termination.,For more information about each parameter, see U(docs.aws.amazon.com/AWSEC2/latest/APIReference/API_BlockDeviceMapping.html)



73
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 73

attribute :volumes

#vpc_subnet_idString?

Returns The subnet ID in which to launch the instance (VPC) If none is provided, ec2_instance will chose the default zone of the default VPC.

Returns:

  • (String, nil)

    The subnet ID in which to launch the instance (VPC) If none is provided, ec2_instance will chose the default zone of the default VPC



65
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 65

attribute :vpc_subnet_id

#waitBoolean?

Returns Whether or not to wait for the desired state (use wait_timeout to customize this).

Returns:

  • (Boolean, nil)

    Whether or not to wait for the desired state (use wait_timeout to customize this)



20
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 20

attribute :wait

#wait_timeoutInteger?

Returns How long to wait (in seconds) for the instance to finish booting/terminating.

Returns:

  • (Integer, nil)

    How long to wait (in seconds) for the instance to finish booting/terminating



24
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 24

attribute :wait_timeout