Class: Ansible::Ruby::Modules::Ec2_instance
- Inherits:
-
Base
- Object
- Ansible::Ruby::Models::Base
- Base
- Ansible::Ruby::Modules::Ec2_instance
- Defined in:
- lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb
Overview
Create and manage AWS EC2 instance
Instance Method Summary collapse
-
#availability_zone ⇒ Object?
Specify an availability zone to use the default subnet it.
-
#cpu_credit_specification ⇒ :unlimited, ...
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.
-
#cpu_options ⇒ Object?
Reduce the number of vCPU exposed to the instance.,Those parameters can only be set at instance launch.
-
#detailed_monitoring ⇒ Object?
Whether to allow detailed cloudwatch metrics to be collected, enabling more detailed alerting.
-
#ebs_optimized ⇒ Object?
Whether instance is should use optimized EBS volumes, see U(docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
-
#filters ⇒ Array<String>, ...
A dict of filters to apply when deciding whether existing instances match and should be altered.
-
#image ⇒ Object?
An image to use for the instance.
-
#image_id ⇒ String?
I(ami) ID to use for the instance.
-
#instance_ids ⇒ Array<String>, ...
If you specify one or more instance IDs, only instances that have the specified IDs are returned.
-
#instance_initiated_shutdown_behavior ⇒ :stop, ...
Whether to stop or terminate an instance upon shutdown.
-
#instance_role ⇒ Object?
The ARN or name of an EC2-enabled instance role to be used.
-
#instance_type ⇒ String?
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.
-
#key_name ⇒ String?
Name of the SSH access key to assign to the instance - must exist in the region the instance is created.
-
#launch_template ⇒ Object?
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.
-
#name ⇒ String?
The Name tag for the instance.
-
#network ⇒ Hash?
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.
-
#purge_tags ⇒ Boolean?
Delete any tags not specified in the task that are on the instance.
-
#security_group ⇒ String?
A security group ID or name.
-
#security_groups ⇒ Object?
A list of security group IDs or names (strings).
-
#state ⇒ :present, ...
Goal state for the instances.
-
#tags ⇒ Hash?
A hash/dictionary of tags to add to the new instance or to add/remove from an existing one.
-
#tenancy ⇒ :dedicated, ...
What type of tenancy to allow an instance to use.
-
#termination_protection ⇒ Object?
Whether to enable termination protection.
-
#tower_callback ⇒ Hash?
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.
-
#user_data ⇒ Object?
Opaque blob of data which is made available to the ec2 instance.
-
#volumes ⇒ Object?
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).
-
#vpc_subnet_id ⇒ String?
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.
-
#wait ⇒ Boolean?
Whether or not to wait for the desired state (use wait_timeout to customize this).
-
#wait_timeout ⇒ Integer?
How long to wait (in seconds) for the instance to finish booting/terminating.
Methods inherited from Base
Methods inherited from Ansible::Ruby::Models::Base
attr_option, attr_options, attribute, #initialize, remove_existing_validations, #to_h, validates
Constructor Details
This class inherits a constructor from Ansible::Ruby::Models::Base
Instance Method Details
#availability_zone ⇒ Object?
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).
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.
97 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 97 attribute :cpu_credit_specification |
#cpu_options ⇒ Object?
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.
101 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 101 attribute :cpu_options |
#detailed_monitoring ⇒ Object?
Returns 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_optimized ⇒ Object?
Returns Whether instance is should use optimized EBS volumes, see U(docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
107 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 107 attribute :ebs_optimized |
#filters ⇒ Array<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.
110 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 110 attribute :filters |
#image ⇒ Object?
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.
47 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 47 attribute :image |
#image_id ⇒ String?
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).
50 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 50 attribute :image_id |
#instance_ids ⇒ Array<String>, ...
Returns 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.
86 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 86 attribute :instance_initiated_shutdown_behavior |
#instance_role ⇒ Object?
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.
114 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 114 attribute :instance_role |
#instance_type ⇒ String?
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.
28 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 28 attribute :instance_type |
#key_name ⇒ String?
Returns 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_template ⇒ Object?
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.
76 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 76 attribute :launch_template |
#name ⇒ String?
Returns The Name tag for the instance.
61 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 61 attribute :name |
#network ⇒ Hash?
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.
69 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 69 attribute :network |
#purge_tags ⇒ Boolean?
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.
43 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 43 attribute :purge_tags |
#security_group ⇒ String?
Returns 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_groups ⇒ Object?
Returns 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.
16 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 16 attribute :state |
#tags ⇒ Hash?
Returns 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.
90 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 90 attribute :tenancy |
#termination_protection ⇒ Object?
Returns 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_callback ⇒ Hash?
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.
35 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 35 attribute :tower_callback |
#user_data ⇒ Object?
Returns 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 |
#volumes ⇒ Object?
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).
73 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 73 attribute :volumes |
#vpc_subnet_id ⇒ String?
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.
65 |
# File 'lib/ansible/ruby/modules/generated/cloud/amazon/ec2_instance.rb', line 65 attribute :vpc_subnet_id |
#wait ⇒ Boolean?
Returns 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_timeout ⇒ Integer?
Returns 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 |