ansible / ansible.builtin / v2.7.18 / module / _ec2_remote_facts
Removed in 2.8
Reason:Replaced with boto3 version. | Alternative:Use M(ec2_instance_facts) instead.
Gather facts about ec2 instances in AWS
| "added in version" 2.0 of ansible.builtin"
Authors: Michael Schuett (@michaeljs1990)
deprecated | supported by certified
pip
Install with pip install ansible==2.7.18
Gather facts about ec2 instances in AWS
# Note: These examples do not set authentication details, see the AWS Guide for details. # Gather facts about all ec2 instances - ec2_remote_facts:
# Gather facts about all running ec2 instances with a tag of Name:Example - ec2_remote_facts: filters: instance-state-name: running "tag:Name": Example
# Gather facts about instance i-123456 - ec2_remote_facts: filters: instance-id: i-123456
# Gather facts about all instances in vpc-123456 that are t2.small type - ec2_remote_facts: filters: vpc-id: vpc-123456 instance-type: t2.small
region: aliases: - aws_region - ec2_region description: - The AWS region to use. If not specified then the value of the AWS_REGION or EC2_REGION environment variable, if any, is used. See U(http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region) type: str ec2_url: description: - Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2_URL environment variable, if any, is used. type: str filters: description: - A dict of filters to apply. Each dict item consists of a filter key and a filter value. See U(http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html) for possible filters. profile: description: - Uses a boto profile. Only works with boto >= 2.24.0. type: str aws_config: description: - A dictionary to modify the botocore configuration. - Parameters can be found at U(https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config). - Only the 'user_agent' key is used for boto modules. See U(http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto) for more boto configuration. type: dict aws_access_key: aliases: - ec2_access_key - access_key description: - AWS access key. If not set then the value of the AWS_ACCESS_KEY_ID, AWS_ACCESS_KEY or EC2_ACCESS_KEY environment variable is used. type: str aws_secret_key: aliases: - ec2_secret_key - secret_key description: - AWS secret key. If not set then the value of the AWS_SECRET_ACCESS_KEY, AWS_SECRET_KEY, or EC2_SECRET_KEY environment variable is used. type: str security_token: aliases: - access_token description: - AWS STS security token. If not set then the value of the AWS_SECURITY_TOKEN or EC2_SECURITY_TOKEN environment variable is used. type: str validate_certs: default: true description: - When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. type: bool debug_botocore_endpoint_logs: default: 'no' description: - Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource_actions key in the task results. Use the aws_resource_action callback to output to total list made during a playbook. The ANSIBLE_DEBUG_BOTOCORE_LOGS environment variable may also be used. type: bool
instances: contains: ami_launch_index: description: 'if more than one instance is started at the same time, this value indicates the order in which the instance was launched, the value of the first instance launched is 0 ' returned: success sample: '0' type: string architecture: description: the instance architecture returned: success sample: x86_64 type: string block_device_mapping: contains: attach_time: description: the attach time for an EBS volume mapped to the instance returned: success sample: '2017-01-03T15:19:52.000Z' type: string delete_on_termination: description: indicates whether the EBS volume is deleted on instance termination returned: success sample: 'true' type: boolean device_name: description: the device name for the EBS volume returned: success sample: /dev/sda1 type: string status: description: the status for the EBS volume returned: success sample: attaching type: string volume_id: description: the volume id of the EBS volume returned: success sample: vol-3160f90df06b24080 type: string description: a structure describing the attached volumes to instance returned: success type: complex client_token: description: the idempotency token provided when instance was launched returned: success sample: Sample-awsmp-DFNBSML8ZMJ9 type: string ebs_optimized: description: whether instance class has EBS optimized flag turned on returned: success sample: 'true' type: boolean groups: contains: id: description: security group id returned: success sample: sg-e203cf94 type: string name: descriptipn: security group name returned: success sample: Sample-Common-Sg type: string description: a list security groups to which the network interface belongs returned: success type: complex hypervisor: description: the hypervisor type of the instance returned: success sample: xen type: string id: description: the id of the instance returned: success sample: i-09275d68c04c1a16c type: string image_id: description: the id of the image used to launch the instance returned: success sample: ami-1748d2f5 type: string instance_profile: contains: arn: description: specifies an ARN of instance profile returned: success sample: arn:aws:iam::171455704129:instance-profile/Sample-IamProfile type: string id: description: instance profile id returned: success sample: AIPAD5WIZGNR9TH6LBFE4 type: string description: the instance profile associated with the instance returned: success type: complex interfaces: contains: id: description: the id of ENI returned: success sample: eni-cf96b081 type: string mac_address: description: the MAC address of ENI returned: success sample: 06:c4:fd:90:dc:61 type: string description: a list of ENI associated to instance returned: success type: complex kernel: description: the kernel id returned: success sample: 'null' type: string key_name: description: the name of the key pair used when the instance was launched returned: success sample: MyKey type: string launch_time": description: the time when the instance was launched returned: success sample: '2017-06-16T15:44:54.000Z' type: string monitoring_state: description: indicates whether detailed monitoring is enabled returned: success sample: disabled type: string private_dns_name: description: the private IPv4 DNS name of the instance returned: success sample: ip-10-21-39-23.ag-net.com type: string private_ip_address: description: the private IPv4 address of the instance returned: success sample: 10.216.139.23 type: string public_dns_name: description: the public DNS name of the instance returned: success sample: ec2-54-194-252-215.eu-west-1.compute.amazonaws.com type: string public_ip_address: description: the public IPv4 address of the instance returned: success sample: 54.194.252.215 type: string ramdisk: description: the RAM disk id returned: success sample: 'null' type: string region: description: the AWS region in which instance is running in returned: success sample: eu-west-1 type: string requester_id: description: the id of the entity that launched the instance on your behalf returned: success sample: 'null' type: string root_device_type: description: the type of root device that the instance uses returned: success sample: ebs type: string source_destination_check: description: indicates whether the instance performs source/destination checking returned: success sample: 'true' type: boolean spot_instance_request_id: description: the id of the spot instance request returned: success sample: 'null' type: string state: description: a message that describes the state change returned: success sample: running type: string tags: contains: key: description: the key of a tag assigned to the resource returned: success sample: Environment type: string description: a dictionary of key/value pairs assigned to the resource returned: success type: complex virtualization_type: description: the virtualization type of the instance returned: success sample: hvm type: string vpc_id: description: the id of the VPC that the instance is running in returned: success sample: vpc-12c9ae4f type: string description: provides details about EC2 instance(s) found in AWS region returned: when EC2 instances are found in AWS region otherwise empty type: complex