AWS: _facts -> _info (part 3) (#57635)

* Rename ec2_ami_facts -> ec2_ami_info.

* Rename ec2_asg_facts -> ec2_asg_info.

* Rename ec2_customer_gateway_facts -> ec2_customer_gateway_info.

* Rename ec2_eip_facts -> ec2_eip_info.

* Rename ec2_elb_facts -> ec2_elb_info.

* Rename ec2_eni_facts -> ec2_eni_info.

* Rename ec2_group_facts -> ec2_group_info.

* Rename ec2_instance_facts -> ec2_instance_info.

* Rename ec2_lc_facts -> ec2_lc_info.

* Rename ec2_placement_group_facts -> ec2_placement_group_info.

* Rename ec2_snapshot_facts -> ec2_snapshot_info.

* Rename ec2_vol_facts -> ec2_vol_info.

* Update module defaults, add changelog and porting guide.

* Forgot one occurence of ec2_instance_facts.

* Update BOTMETA.

* Break too long line.
This commit is contained in:
Felix Fontein 2019-06-10 19:33:38 +02:00 committed by GitHub
parent 1d054a6671
commit 804d5eaf8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 280 additions and 205 deletions

6
.github/BOTMETA.yml vendored
View file

@ -61,12 +61,12 @@ files:
$modules/cloud/amazon/ec2_ami.py: willthames
$modules/cloud/amazon/ec2_asg.py: $team_ansible s-hertel ryansb
$modules/cloud/amazon/ec2_group.py: $team_ansible
$modules/cloud/amazon/ec2_group_facts.py: willthames
$modules/cloud/amazon/ec2_group_info.py: willthames
$modules/cloud/amazon/ec2_instance.py: Shaps
$modules/cloud/amazon/ec2_instance_facts.py: willthames
$modules/cloud/amazon/ec2_instance_info.py: willthames
$modules/cloud/amazon/ec2_key.py: $team_ansible
$modules/cloud/amazon/ec2_lc.py: $team_ansible
$modules/cloud/amazon/ec2_lc_facts.py: willthames
$modules/cloud/amazon/ec2_lc_info.py: willthames
$modules/cloud/amazon/ec2_metric_alarm.py: $team_ansible
$modules/cloud/amazon/ec2_tag.py: $team_ansible
$modules/cloud/amazon/ec2_vol.py: $team_ansible

View file

@ -0,0 +1,13 @@
minor_changes:
- The ``ec2_ami_facts`` module has been renamed to ``ec2_ami_info``.
- The ``ec2_asg_facts`` module has been renamed to ``ec2_asg_info``.
- The ``ec2_customer_gateway_facts`` module has been renamed to ``ec2_customer_gateway_info``.
- The ``ec2_eip_facts`` module has been renamed to ``ec2_eip_info``.
- The ``ec2_elb_facts`` module has been renamed to ``ec2_elb_info``.
- The ``ec2_eni_facts`` module has been renamed to ``ec2_eni_info``.
- The ``ec2_group_facts`` module has been renamed to ``ec2_group_info``.
- The ``ec2_instance_facts`` module has been renamed to ``ec2_instance_info``.
- The ``ec2_lc_facts`` module has been renamed to ``ec2_lc_info``.
- The ``ec2_placement_group_facts`` module has been renamed to ``ec2_placement_group_info``.
- The ``ec2_snapshot_facts`` module has been renamed to ``ec2_snapshot_info``.
- The ``ec2_vol_facts`` module has been renamed to ``ec2_vol_info``.

View file

@ -103,6 +103,18 @@ Noteworthy module changes
* The ``aws_sgw_facts`` module was renamed to :ref:`aws_sgw_info <aws_sgw_info_module>`.
* The ``aws_waf_facts`` module was renamed to :ref:`aws_waf_info <aws_waf_info_module>`.
* The ``cloudwatchlogs_log_group_facts`` module was renamed to :ref:`cloudwatchlogs_log_group_info <cloudwatchlogs_log_group_info_module>`.
* The ``ec2_ami_facts`` module was renamed to :ref:`ec2_ami_info <ec2_ami_info_module>`.
* The ``ec2_asg_facts`` module was renamed to :ref:`ec2_asg_info <ec2_asg_info_module>`.
* The ``ec2_customer_gateway_facts`` module was renamed to :ref:`ec2_customer_gateway_info <ec2_customer_gateway_info_module>`.
* The ``ec2_eip_facts`` module was renamed to :ref:`ec2_eip_info <ec2_eip_info_module>`.
* The ``ec2_elb_facts`` module was renamed to :ref:`ec2_elb_info <ec2_elb_info_module>`.
* The ``ec2_eni_facts`` module was renamed to :ref:`ec2_eni_info <ec2_eni_info_module>`.
* The ``ec2_group_facts`` module was renamed to :ref:`ec2_group_info <ec2_group_info_module>`.
* The ``ec2_instance_facts`` module was renamed to :ref:`ec2_instance_info <ec2_instance_info_module>`.
* The ``ec2_lc_facts`` module was renamed to :ref:`ec2_lc_info <ec2_lc_info_module>`.
* The ``ec2_placement_group_facts`` module was renamed to :ref:`ec2_placement_group_info <ec2_placement_group_info_module>`.
* The ``ec2_snapshot_facts`` module was renamed to :ref:`ec2_snapshot_info <ec2_snapshot_info_module>`.
* The ``ec2_vol_facts`` module was renamed to :ref:`ec2_vol_info <ec2_vol_info_module>`.
* The ``elasticache_facts`` module was renamed to :ref:`elasticache_info <elasticache_info_module>`.
* The ``elb_application_lb_facts`` module was renamed to :ref:`elb_application_lb_info <elb_application_lb_info_module>`.
* The ``elb_classic_lb_facts`` module was renamed to :ref:`elb_classic_lb_info <elb_classic_lb_info_module>`.

View file

@ -70,7 +70,7 @@ Setting a default AWS region for specific EC2-related modules::
module_defaults:
ec2:
region: '{{ my_region }}'
ec2_instance_facts:
ec2_instance_info:
region: '{{ my_region }}'
ec2_vpc_net_facts:
region: '{{ my_region }}'
@ -113,6 +113,6 @@ In a playbook, you can set module defaults for whole groups of modules, such as
tasks:
- aws_s3_bucket_facts:
# now the region is shared between both facts modules
- ec2_ami_facts:
- ec2_ami_info:
filters:
name: 'RHEL*7.5*'

View file

@ -114,39 +114,39 @@ groupings:
- aws
ec2_ami_copy:
- aws
ec2_ami_facts:
ec2_ami_info:
- aws
ec2_asg:
- aws
ec2_asg_facts:
ec2_asg_info:
- aws
ec2_asg_lifecycle_hook:
- aws
ec2_customer_gateway:
- aws
ec2_customer_gateway_facts:
ec2_customer_gateway_info:
- aws
ec2_eip:
- aws
ec2_eip_facts:
ec2_eip_info:
- aws
ec2_elb:
- aws
ec2_elb_facts:
ec2_elb_info:
- aws
ec2_elb_lb:
- aws
ec2_eni:
- aws
ec2_eni_facts:
ec2_eni_info:
- aws
ec2_group:
- aws
ec2_group_facts:
ec2_group_info:
- aws
ec2_instance:
- aws
ec2_instance_facts:
ec2_instance_info:
- aws
ec2_key:
- aws
@ -154,7 +154,7 @@ groupings:
- aws
ec2_lc:
- aws
ec2_lc_facts:
ec2_lc_info:
- aws
ec2_lc_find:
- aws
@ -162,7 +162,7 @@ groupings:
- aws
ec2_placement_group:
- aws
ec2_placement_group_facts:
ec2_placement_group_info:
- aws
ec2_scaling_policy:
- aws
@ -170,13 +170,13 @@ groupings:
- aws
ec2_snapshot_copy:
- aws
ec2_snapshot_facts:
ec2_snapshot_info:
- aws
ec2_tag:
- aws
ec2_vol:
- aws
ec2_vol_facts:
ec2_vol_info:
- aws
ec2_vpc_dhcp_option:
- aws

View file

@ -0,0 +1 @@
ec2_ami_info.py

View file

@ -0,0 +1 @@
ec2_asg_info.py

View file

@ -0,0 +1 @@
ec2_customer_gateway_info.py

View file

@ -0,0 +1 @@
ec2_eip_info.py

View file

@ -0,0 +1 @@
ec2_elb_info.py

View file

@ -0,0 +1 @@
ec2_eni_info.py

View file

@ -0,0 +1 @@
ec2_group_info.py

View file

@ -0,0 +1 @@
ec2_instance_info.py

View file

@ -0,0 +1 @@
ec2_lc_info.py

View file

@ -0,0 +1 @@
ec2_placement_group_info.py

View file

@ -0,0 +1 @@
ec2_snapshot_info.py

View file

@ -0,0 +1 @@
ec2_vol_info.py

View file

@ -10,10 +10,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: ec2_ami_facts
module: ec2_ami_info
version_added: '2.5'
short_description: Gather facts about ec2 AMIs
description: Gather facts about ec2 AMIs
short_description: Gather information about ec2 AMIs
description:
- Gather information about ec2 AMIs
- This module was called C(ec2_ami_facts) before Ansible 2.9. The usage did not change.
author:
- Prasad Katti (@prasadkatti)
requirements: [ boto3 ]
@ -49,22 +51,22 @@ extends_documentation_fragment:
EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details.
- name: gather facts about an AMI using ami-id
ec2_ami_facts:
- name: gather information about an AMI using ami-id
ec2_ami_info:
image_ids: ami-5b488823
- name: gather facts about all AMIs with tag key Name and value webapp
ec2_ami_facts:
- name: gather information about all AMIs with tag key Name and value webapp
ec2_ami_info:
filters:
"tag:Name": webapp
- name: gather facts about an AMI with 'AMI Name' equal to foobar
ec2_ami_facts:
- name: gather information about an AMI with 'AMI Name' equal to foobar
ec2_ami_info:
filters:
name: foobar
- name: gather facts about Ubuntu 17.04 AMIs published by Canonical (099720109477)
ec2_ami_facts:
- name: gather information about Ubuntu 17.04 AMIs published by Canonical (099720109477)
ec2_ami_info:
owners: 099720109477
filters:
name: "ubuntu/images/ubuntu-zesty-17.04-*"
@ -252,6 +254,8 @@ def main():
)
module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True)
if module._module._name == 'ec2_ami_facts':
module._module.deprecate("The 'ec2_ami_facts' module has been renamed to 'ec2_ami_info'", version='2.13')
region, ec2_url, aws_connect_params = get_aws_connection_info(module, boto3=True)

View file

@ -13,10 +13,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: ec2_asg_facts
short_description: Gather facts about ec2 Auto Scaling Groups (ASGs) in AWS
module: ec2_asg_info
short_description: Gather information about ec2 Auto Scaling Groups (ASGs) in AWS
description:
- Gather facts about ec2 Auto Scaling Groups (ASGs) in AWS
- Gather information about ec2 Auto Scaling Groups (ASGs) in AWS
- This module was called C(ec2_asg_facts) before Ansible 2.9. The usage did not change.
version_added: "2.2"
requirements: [ boto3 ]
author: "Rob White (@wimnat)"
@ -41,36 +42,36 @@ EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Find all groups
- ec2_asg_facts:
- ec2_asg_info:
register: asgs
# Find a group with matching name/prefix
- ec2_asg_facts:
- ec2_asg_info:
name: public-webserver-asg
register: asgs
# Find a group with matching tags
- ec2_asg_facts:
- ec2_asg_info:
tags:
project: webapp
env: production
register: asgs
# Find a group with matching name/prefix and tags
- ec2_asg_facts:
- ec2_asg_info:
name: myproject
tags:
env: production
register: asgs
# Fail if no groups are found
- ec2_asg_facts:
- ec2_asg_info:
name: public-webserver-asg
register: asgs
failed_when: "{{ asgs.results | length == 0 }}"
# Fail if more than 1 group is found
- ec2_asg_facts:
- ec2_asg_info:
name: public-webserver-asg
register: asgs
failed_when: "{{ asgs.results | length > 1 }}"
@ -395,6 +396,8 @@ def main():
)
)
module = AnsibleModule(argument_spec=argument_spec)
if module._name == 'ec2_asg_facts':
module.deprecate("The 'ec2_asg_facts' module has been renamed to 'ec2_asg_info'", version='2.13')
if not HAS_BOTO3:
module.fail_json(msg='boto3 required for this module')

View file

@ -8,10 +8,11 @@ ANSIBLE_METADATA = {'status': ['preview'],
DOCUMENTATION = '''
---
module: ec2_customer_gateway_facts
short_description: Gather facts about customer gateways in AWS
module: ec2_customer_gateway_info
short_description: Gather information about customer gateways in AWS
description:
- Gather facts about customer gateways in AWS
- Gather information about customer gateways in AWS
- This module was called C(ec2_customer_gateway_facts) before Ansible 2.9. The usage did not change.
version_added: "2.5"
requirements: [ boto3 ]
author: Madhura Naniwadekar (@Madhura-CSI)
@ -31,24 +32,24 @@ extends_documentation_fragment:
EXAMPLES = '''
# # Note: These examples do not set authentication details, see the AWS Guide for details.
- name: Gather facts about all customer gateways
ec2_customer_gateway_facts:
- name: Gather information about all customer gateways
ec2_customer_gateway_info:
- name: Gather facts about a filtered list of customer gateways, based on tags
ec2_customer_gateway_facts:
- name: Gather information about a filtered list of customer gateways, based on tags
ec2_customer_gateway_info:
region: ap-southeast-2
filters:
"tag:Name": test-customer-gateway
"tag:AltName": test-customer-gateway-alt
register: cust_gw_facts
register: cust_gw_info
- name: Gather facts about a specific customer gateway by specifying customer gateway ID
ec2_customer_gateway_facts:
- name: Gather information about a specific customer gateway by specifying customer gateway ID
ec2_customer_gateway_info:
region: ap-southeast-2
customer_gateway_ids:
- 'cgw-48841a09'
- 'cgw-fec021ce'
register: cust_gw_facts
register: cust_gw_info
'''
RETURN = '''
@ -123,6 +124,8 @@ def main():
module = AnsibleAWSModule(argument_spec=argument_spec,
mutually_exclusive=[['customer_gateway_ids', 'filters']],
supports_check_mode=True)
if module._module._name == 'ec2_customer_gateway_facts':
module._module.deprecate("The 'ec2_customer_gateway_facts' module has been renamed to 'ec2_customer_gateway_info'", version='2.13')
region, ec2_url, aws_connect_params = get_aws_connection_info(module, boto3=True)

View file

@ -9,10 +9,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: ec2_eip_facts
module: ec2_eip_info
short_description: List EC2 EIP details
description:
- List details of EC2 Elastic IP addresses.
- This module was called C(ec2_eip_facts) before Ansible 2.9. The usage did not change.
version_added: "2.6"
author: "Brad Macpherson (@iiibrad)"
options:
@ -33,11 +34,11 @@ EXAMPLES = '''
# see the AWS Guide for details.
# List all EIP addresses in the current region.
- ec2_eip_facts:
- ec2_eip_info:
register: regional_eip_addresses
# List all EIP addresses for a VM.
- ec2_eip_facts:
- ec2_eip_info:
filters:
instance-id: i-123456789
register: my_vm_eips
@ -45,7 +46,7 @@ EXAMPLES = '''
- debug: msg="{{ my_vm_eips.addresses | json_query(\"[?private_ip_address=='10.0.0.5']\") }}"
# List all EIP addresses for several VMs.
- ec2_eip_facts:
- ec2_eip_info:
filters:
instance-id:
- i-123456789
@ -53,13 +54,13 @@ EXAMPLES = '''
register: my_vms_eips
# List all EIP addresses using the 'Name' tag as a filter.
- ec2_eip_facts:
- ec2_eip_info:
filters:
tag:Name: www.example.com
register: my_vms_eips
# List all EIP addresses using the Allocation-id as a filter
- ec2_eip_facts:
- ec2_eip_info:
filters:
allocation-id: eipalloc-64de1b01
register: my_vms_eips
@ -130,6 +131,8 @@ def main():
),
supports_check_mode=True
)
if module._module._name == 'ec2_eip_facts':
module._module.deprecate("The 'ec2_eip_facts' module has been renamed to 'ec2_eip_info'", version='2.13')
module.exit_json(changed=False, addresses=get_eips_details(module))

View file

@ -20,10 +20,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: ec2_elb_facts
short_description: Gather facts about EC2 Elastic Load Balancers in AWS
module: ec2_elb_info
short_description: Gather information about EC2 Elastic Load Balancers in AWS
description:
- Gather facts about EC2 Elastic Load Balancers in AWS
- Gather information about EC2 Elastic Load Balancers in AWS
- This module was called C(ec2_elb_facts) before Ansible 2.9. The usage did not change.
version_added: "2.0"
author:
- "Michael Schultz (@mjschultz)"
@ -31,7 +32,7 @@ author:
options:
names:
description:
- List of ELB names to gather facts about. Pass this option to gather facts about a set of ELBs, otherwise, all ELBs are returned.
- List of ELB names to gather information about. Pass this option to gather information about a set of ELBs, otherwise, all ELBs are returned.
aliases: ['elb_ids', 'ec2_elbs']
extends_documentation_fragment:
- aws
@ -42,38 +43,38 @@ EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Output format tries to match ec2_elb_lb module input parameters
# Gather facts about all ELBs
# Gather information about all ELBs
- action:
module: ec2_elb_facts
register: elb_facts
module: ec2_elb_info
register: elb_info
- action:
module: debug
msg: "{{ item.dns_name }}"
loop: "{{ elb_facts.elbs }}"
loop: "{{ elb_info.elbs }}"
# Gather facts about a particular ELB
# Gather information about a particular ELB
- action:
module: ec2_elb_facts
module: ec2_elb_info
names: frontend-prod-elb
register: elb_facts
register: elb_info
- action:
module: debug
msg: "{{ elb_facts.elbs.0.dns_name }}"
msg: "{{ elb_info.elbs.0.dns_name }}"
# Gather facts about a set of ELBs
# Gather information about a set of ELBs
- action:
module: ec2_elb_facts
module: ec2_elb_info
names:
- frontend-prod-elb
- backend-prod-elb
register: elb_facts
register: elb_info
- action:
module: debug
msg: "{{ item.dns_name }}"
loop: "{{ elb_facts.elbs }}"
loop: "{{ elb_info.elbs }}"
'''
@ -238,6 +239,8 @@ def main():
)
module = AnsibleModule(argument_spec=argument_spec,
supports_check_mode=True)
if module._name == 'ec2_elb_facts':
module.deprecate("The 'ec2_elb_facts' module has been renamed to 'ec2_elb_info'", version='2.13')
if not HAS_BOTO:
module.fail_json(msg='boto required for this module')
@ -251,14 +254,14 @@ def main():
elb_information = ElbInformation(
module, names, region, **aws_connect_params)
ec2_facts_result = dict(changed=False,
elbs=elb_information.list_elbs())
ec2_info_result = dict(changed=False,
elbs=elb_information.list_elbs())
except BotoServerError as err:
module.fail_json(msg="{0}: {1}".format(err.error_code, err.error_message),
exception=traceback.format_exc())
module.exit_json(**ec2_facts_result)
module.exit_json(**ec2_info_result)
if __name__ == '__main__':

View file

@ -20,10 +20,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: ec2_eni_facts
short_description: Gather facts about ec2 ENI interfaces in AWS
module: ec2_eni_info
short_description: Gather information about ec2 ENI interfaces in AWS
description:
- Gather facts about ec2 ENI interfaces in AWS
- Gather information about ec2 ENI interfaces in AWS
- This module was called C(ec2_eni_facts) before Ansible 2.9. The usage did not change.
version_added: "2.0"
author: "Rob White (@wimnat)"
requirements: [ boto3 ]
@ -40,11 +41,11 @@ extends_documentation_fragment:
EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Gather facts about all ENIs
- ec2_eni_facts:
# Gather information about all ENIs
- ec2_eni_info:
# Gather facts about a particular ENI
- ec2_eni_facts:
# Gather information about a particular ENI
- ec2_eni_info:
filters:
network-interface-id: eni-xxxxxxx
@ -264,6 +265,8 @@ def main():
)
module = AnsibleModule(argument_spec=argument_spec)
if module._name == 'ec2_eni_facts':
module.deprecate("The 'ec2_eni_facts' module has been renamed to 'ec2_eni_info'", version='2.13')
if not HAS_BOTO3:
module.fail_json(msg='boto3 required for this module')

View file

@ -13,10 +13,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: ec2_group_facts
short_description: Gather facts about ec2 security groups in AWS.
module: ec2_group_info
short_description: Gather information about ec2 security groups in AWS.
description:
- Gather facts about ec2 security groups in AWS.
- Gather information about ec2 security groups in AWS.
- This module was called C(ec2_group_facts) before Ansible 2.9. The usage did not change.
version_added: "2.3"
requirements: [ boto3 ]
author:
@ -41,45 +42,46 @@ extends_documentation_fragment:
EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Gather facts about all security groups
- ec2_group_facts:
# Gather information about all security groups
- ec2_group_info:
# Gather facts about all security groups in a specific VPC
- ec2_group_facts:
# Gather information about all security groups in a specific VPC
- ec2_group_info:
filters:
vpc-id: vpc-12345678
# Gather facts about all security groups in a specific VPC
- ec2_group_facts:
# Gather information about all security groups in a specific VPC
- ec2_group_info:
filters:
vpc-id: vpc-12345678
# Gather facts about a security group
- ec2_group_facts:
# Gather information about a security group
- ec2_group_info:
filters:
group-name: example-1
# Gather facts about a security group by id
- ec2_group_facts:
# Gather information about a security group by id
- ec2_group_info:
filters:
group-id: sg-12345678
# Gather facts about a security group with multiple filters, also mixing the use of underscores as filter keys
- ec2_group_facts:
# Gather information about a security group with multiple filters, also mixing the use of underscores as filter keys
- ec2_group_info:
filters:
group_id: sg-12345678
vpc-id: vpc-12345678
# Gather facts about various security groups
- ec2_group_facts:
# Gather information about various security groups
- ec2_group_info:
filters:
group-name:
- example-1
- example-2
- example-3
# Gather facts about any security group with a tag key Name and value Example. The quotes around 'tag:name' are important because of the colon in the value
- ec2_group_facts:
# Gather information about any security group with a tag key Name and value Example.
# The quotes around 'tag:name' are important because of the colon in the value
- ec2_group_info:
filters:
"tag:Name": Example
'''
@ -115,6 +117,8 @@ def main():
module = AnsibleModule(argument_spec=argument_spec,
supports_check_mode=True)
if module._name == 'ec2_group_facts':
module.deprecate("The 'ec2_group_facts' module has been renamed to 'ec2_group_info'", version='2.13')
if not HAS_BOTO3:
module.fail_json(msg='boto3 required for this module')

View file

@ -73,7 +73,7 @@ options:
type: bool
image:
description:
- An image to use for the instance. The ec2_ami_facts module may be used to retrieve images.
- An image to use for the instance. The M(ec2_ami_info) 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.

View file

@ -12,10 +12,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: ec2_instance_facts
short_description: Gather facts about ec2 instances in AWS
module: ec2_instance_info
short_description: Gather information about ec2 instances in AWS
description:
- Gather facts about ec2 instances in AWS
- Gather information about ec2 instances in AWS
- This module was called C(ec2_instance_facts) before Ansible 2.9. The usage did not change.
version_added: "2.4"
author:
- Michael Schuett (@michaeljs1990)
@ -43,26 +44,26 @@ extends_documentation_fragment:
EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Gather facts about all instances
- ec2_instance_facts:
# Gather information about all instances
- ec2_instance_info:
# Gather facts about all instances in AZ ap-southeast-2a
- ec2_instance_facts:
# Gather information about all instances in AZ ap-southeast-2a
- ec2_instance_info:
filters:
availability-zone: ap-southeast-2a
# Gather facts about a particular instance using ID
- ec2_instance_facts:
# Gather information about a particular instance using ID
- ec2_instance_info:
instance_ids:
- i-12345678
# Gather facts about any instance with a tag key Name and value Example
- ec2_instance_facts:
# Gather information about any instance with a tag key Name and value Example
- ec2_instance_info:
filters:
"tag:Name": Example
# Gather facts about any instance in states "shutting-down", "stopping", "stopped"
- ec2_instance_facts:
# Gather information about any instance in states "shutting-down", "stopping", "stopped"
- ec2_instance_info:
filters:
instance-state-name: [ "shutting-down", "stopping", "stopped" ]
@ -543,6 +544,8 @@ def main():
],
supports_check_mode=True
)
if module._name == 'ec2_instance_facts':
module.deprecate("The 'ec2_instance_facts' module has been renamed to 'ec2_instance_information'", version='2.13')
if not HAS_BOTO3:
module.fail_json(msg='boto3 required for this module')

View file

@ -14,10 +14,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: ec2_lc_facts
short_description: Gather facts about AWS Autoscaling Launch Configurations
module: ec2_lc_info
short_description: Gather information about AWS Autoscaling Launch Configurations
description:
- Gather facts about AWS Autoscaling Launch Configurations
- Gather information about AWS Autoscaling Launch Configurations
- This module was called C(ec2_lc_facts) before Ansible 2.9. The usage did not change.
version_added: "2.3"
author: "Loïc Latreille (@psykotox)"
requirements: [ boto3 ]
@ -52,15 +53,15 @@ extends_documentation_fragment:
EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Gather facts about all launch configurations
- ec2_lc_facts:
# Gather information about all launch configurations
- ec2_lc_info:
# Gather facts about launch configuration with name "example"
- ec2_lc_facts:
# Gather information about launch configuration with name "example"
- ec2_lc_info:
name: example
# Gather facts sorted by created_time from most recent to least recent
- ec2_lc_facts:
# Gather information sorted by created_time from most recent to least recent
- ec2_lc_info:
sort: created_time
sort_order: descending
'''
@ -213,6 +214,8 @@ def main():
)
module = AnsibleModule(argument_spec=argument_spec)
if module._name == 'ec2_lc_facts':
module.deprecate("The 'ec2_lc_facts' module has been renamed to 'ec2_lc_info'", version='2.13')
if not HAS_BOTO3:
module.fail_json(msg='boto3 required for this module')

View file

@ -9,10 +9,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: ec2_placement_group_facts
module: ec2_placement_group_info
short_description: List EC2 Placement Group(s) details
description:
- List details of EC2 Placement Group(s).
- This module was called C(ec2_placement_group_facts) before Ansible 2.9. The usage did not change.
version_added: "2.5"
author: "Brad Macpherson (@iiibrad)"
options:
@ -32,11 +33,11 @@ EXAMPLES = '''
# see the AWS Guide for details.
# List all placement groups.
- ec2_placement_group_facts:
- ec2_placement_group_info:
register: all_ec2_placement_groups
# List two placement groups.
- ec2_placement_group_facts:
- ec2_placement_group_info:
names:
- my-cluster
- my-other-cluster
@ -117,6 +118,8 @@ def main():
argument_spec=argument_spec,
supports_check_mode=True
)
if module._module._name == 'ec2_placement_group_facts':
module._module.deprecate("The 'ec2_placement_group_facts' module has been renamed to 'ec2_placement_group_info'", version='2.13')
region, ec2_url, aws_connect_params = get_aws_connection_info(
module, boto3=True)

View file

@ -13,10 +13,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: ec2_snapshot_facts
short_description: Gather facts about ec2 volume snapshots in AWS
module: ec2_snapshot_info
short_description: Gather information about ec2 volume snapshots in AWS
description:
- Gather facts about ec2 volume snapshots in AWS
- Gather information about ec2 volume snapshots in AWS
- This module was called C(ec2_snapshot_facts) before Ansible 2.9. The usage did not change.
version_added: "2.1"
requirements: [ boto3 ]
author: "Rob White (@wimnat)"
@ -57,36 +58,36 @@ extends_documentation_fragment:
EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Gather facts about all snapshots, including public ones
- ec2_snapshot_facts:
# Gather information about all snapshots, including public ones
- ec2_snapshot_info:
# Gather facts about all snapshots owned by the account 0123456789
- ec2_snapshot_facts:
# Gather information about all snapshots owned by the account 0123456789
- ec2_snapshot_info:
filters:
owner-id: 0123456789
# Or alternatively...
- ec2_snapshot_facts:
- ec2_snapshot_info:
owner_ids:
- 0123456789
# Gather facts about a particular snapshot using ID
- ec2_snapshot_facts:
# Gather information about a particular snapshot using ID
- ec2_snapshot_info:
filters:
snapshot-id: snap-00112233
# Or alternatively...
- ec2_snapshot_facts:
- ec2_snapshot_info:
snapshot_ids:
- snap-00112233
# Gather facts about any snapshot with a tag key Name and value Example
- ec2_snapshot_facts:
# Gather information about any snapshot with a tag key Name and value Example
- ec2_snapshot_info:
filters:
"tag:Name": Example
# Gather facts about any snapshot with an error status
- ec2_snapshot_facts:
# Gather information about any snapshot with an error status
- ec2_snapshot_info:
filters:
status: error
@ -230,6 +231,8 @@ def main():
['snapshot_ids', 'owner_ids', 'restorable_by_user_ids', 'filters']
]
)
if module._name == 'ec2_snapshot_facts':
module.deprecate("The 'ec2_snapshot_facts' module has been renamed to 'ec2_snapshot_info'", version='2.13')
if not HAS_BOTO3:
module.fail_json(msg='boto3 required for this module')

View file

@ -13,10 +13,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: ec2_vol_facts
short_description: Gather facts about ec2 volumes in AWS
module: ec2_vol_info
short_description: Gather information about ec2 volumes in AWS
description:
- Gather facts about ec2 volumes in AWS
- Gather information about ec2 volumes in AWS
- This module was called C(ec2_vol_facts) before Ansible 2.9. The usage did not change.
version_added: "2.1"
requirements: [ boto3 ]
author: "Rob White (@wimnat)"
@ -33,21 +34,21 @@ extends_documentation_fragment:
EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Gather facts about all volumes
- ec2_vol_facts:
# Gather information about all volumes
- ec2_vol_info:
# Gather facts about a particular volume using volume ID
- ec2_vol_facts:
# Gather information about a particular volume using volume ID
- ec2_vol_info:
filters:
volume-id: vol-00112233
# Gather facts about any volume with a tag key Name and value Example
- ec2_vol_facts:
# Gather information about any volume with a tag key Name and value Example
- ec2_vol_info:
filters:
"tag:Name": Example
# Gather facts about any volume that is attached
- ec2_vol_facts:
# Gather information about any volume that is attached
- ec2_vol_info:
filters:
attachment.status: attached
@ -131,6 +132,8 @@ def main():
)
module = AnsibleModule(argument_spec=argument_spec)
if module._name == 'ec2_vol_facts':
module.deprecate("The 'ec2_vol_facts' module has been renamed to 'ec2_vol_info'", version='2.13')
if not HAS_BOTO3:
module.fail_json(msg='boto3 required for this module')

View file

@ -1,4 +1,4 @@
cloud/aws
shippable/aws/group2
unstable
ec2_ami_facts
ec2_ami_info

View file

@ -125,7 +125,7 @@
# ============================================================
- name: gather facts about the image created
ec2_ami_facts:
ec2_ami_info:
image_ids: '{{ ec2_ami_image_id }}'
<<: *aws_connection_info
register: ami_facts_result
@ -353,7 +353,7 @@
- "'image_id' not in result"
- name: ensure the snapshot still exists
ec2_snapshot_facts:
ec2_snapshot_info:
snapshot_ids:
- '{{ ec2_ami_snapshot }}'
<<: *aws_connection_info

View file

@ -415,7 +415,7 @@
register: asg_job
- name: get ec2_asg facts for 3 minutes
ec2_asg_facts:
ec2_asg_info:
name: "{{ resource_prefix }}-asg"
<<: *aws_connection_info
register: output
@ -475,9 +475,9 @@
poll: 0
register: asg_job
# Collect ec2_asg_facts for 3 minutes
- name: get ec2_asg facts
ec2_asg_facts:
# Collect ec2_asg_info for 3 minutes
- name: get ec2_asg information
ec2_asg_info:
name: "{{ resource_prefix }}-asg"
<<: *aws_connection_info
register: output

View file

@ -54,7 +54,7 @@
check_mode: yes
- name: "fact presented ec2 instance"
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-ebs-vols"
"instance-state-name": "running"
@ -62,7 +62,7 @@
register: presented_instance_fact
- name: "fact checkmode ec2 instance"
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-ebs-vols-checkmode"
"instance-state-name": "running"

View file

@ -37,7 +37,7 @@
check_mode: yes
- name: fact presented ec2 instance
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-checkmode-comparison"
"instance-state-name": "running"
@ -45,7 +45,7 @@
register: presented_instance_fact
- name: fact checkmode ec2 instance
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-checkmode-comparison-checkmode"
"instance-state-name": "running"
@ -67,7 +67,7 @@
check_mode: yes
- name: fact ec2 instance
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-checkmode-comparison"
<<: *aws_connection_info
@ -86,7 +86,7 @@
<<: *aws_connection_info
- name: fact stopped ec2 instance
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-checkmode-comparison"
<<: *aws_connection_info
@ -106,7 +106,7 @@
check_mode: yes
- name: fact ec2 instance
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-checkmode-comparison"
<<: *aws_connection_info
@ -125,7 +125,7 @@
<<: *aws_connection_info
- name: fact ec2 instance.
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-checkmode-comparison"
<<: *aws_connection_info
@ -145,7 +145,7 @@
check_mode: yes
- name: fact ec2 instance
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-checkmode-comparison"
<<: *aws_connection_info
@ -164,7 +164,7 @@
<<: *aws_connection_info
- name: fact ec2 instance
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-checkmode-comparison"
<<: *aws_connection_info

View file

@ -78,7 +78,7 @@
check_mode: yes
- name: "fact presented ec2 instance"
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-c4large-1-threads-per-core"
"instance-state-name": "running"
@ -86,7 +86,7 @@
register: presented_instance_fact
- name: "fact checkmode ec2 instance"
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-c4large-1-threads-per-core-checkmode"
"instance-state-name": "running"

View file

@ -37,7 +37,7 @@
check_mode: yes
- name: "fact presented ec2 instance"
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-default-vpc"
"instance-state-name": "running"
@ -45,7 +45,7 @@
register: presented_instance_fact
- name: "fact checkmode ec2 instance"
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-default-vpc-checkmode"
"instance-state-name": "running"

View file

@ -21,7 +21,7 @@
register: ebs_opt_in_vpc
- name: Get ec2 instance facts
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-ebs-optimized-instance-in-vpc"
"instance-state-name": "running"

View file

@ -90,7 +90,7 @@
check_mode: yes
- name: "fact presented ec2 instance"
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-eni-vpc"
"instance-state-name": "running"
@ -98,7 +98,7 @@
register: presented_instance_fact
- name: "fact checkmode ec2 instance"
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-eni-vpc-checkmode"
"instance-state-name": "running"

View file

@ -63,7 +63,7 @@
check_mode: yes
- name: "fact presented ec2 instance"
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-instance-role"
"instance-state-name": "running"
@ -71,7 +71,7 @@
register: presented_instance_fact
- name: "fact checkmode ec2 instance"
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-instance-role-checkmode"
"instance-state-name": "running"

View file

@ -40,7 +40,7 @@
check_mode: yes
- name: Facts for ec2 test instance
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-no-wait"
"instance-state-name": "running"
@ -50,7 +50,7 @@
retries: 10
- name: Facts for checkmode ec2 test instance
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-no-wait-checkmode"
"instance-state-name": "running"

View file

@ -115,7 +115,7 @@
retries: 10
- name: remove ENIs
ec2_eni_facts:
ec2_eni_info:
filters:
vpc-id: "{{ testing_vpc.vpc.id }}"
<<: *aws_connection_info

View file

@ -79,7 +79,7 @@
that: 'not remake_in_test_vpc.instances[0].source_dest_check'
- name: "fact presented ec2 instance"
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-basic-vpc-create"
"instance-state-name": "running"
@ -87,7 +87,7 @@
register: presented_instance_fact
- name: "fact checkmode ec2 instance"
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-basic-vpc-create-checkmode"
"instance-state-name": "running"
@ -113,7 +113,7 @@
<<: *aws_connection_info
register: add_another_tag
- ec2_instance_facts:
- ec2_instance_info:
instance_ids: "{{ add_another_tag.instance_ids }}"
<<: *aws_connection_info
register: check_tags
@ -135,7 +135,7 @@
vpc_subnet_id: "{{ testing_subnet_b.subnet.id }}"
instance_type: t2.micro
<<: *aws_connection_info
- ec2_instance_facts:
- ec2_instance_info:
instance_ids: "{{ add_another_tag.instance_ids }}"
<<: *aws_connection_info
register: check_tags

View file

@ -41,7 +41,7 @@
check_mode: yes
- name: "fact presented ec2 instance"
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-protected-instance-in-vpc"
"instance-state-name": "running"
@ -49,7 +49,7 @@
register: presented_instance_fact
- name: "fact checkmode ec2 instance"
ec2_instance_facts:
ec2_instance_info:
filters:
"tag:Name": "{{ resource_prefix }}-test-protected-instance-in-vpc-checkmode"
"instance-state-name": "running"

View file

@ -108,7 +108,7 @@
<<: *aws_connection_info
register: add_another_tag
- ec2_instance_facts:
- ec2_instance_info:
instance_ids: "{{ add_another_tag.instance_ids }}"
<<: *aws_connection_info
register: check_tags
@ -130,7 +130,7 @@
vpc_subnet_id: "{{ testing_subnet_b.subnet.id }}"
instance_type: t2.micro
<<: *aws_connection_info
- ec2_instance_facts:
- ec2_instance_info:
instance_ids: "{{ add_another_tag.instance_ids }}"
<<: *aws_connection_info
register: check_tags

View file

@ -1,5 +1,5 @@
---
# tasks file for test_ec2_vol_facts
# tasks file for test_ec2_vol_info
- name: Set up AWS connection info
set_fact:
aws_connection_info: &aws_connection_info
@ -10,7 +10,7 @@
no_log: true
- block:
- ec2_ami_facts:
- ec2_ami_info:
<<: *aws_connection_info
filters:
architecture: x86_64
@ -21,7 +21,7 @@
- name: Create test instance
ec2_instance:
name: "{{ resource_prefix }}_ansible_ec2_vol_facts_test"
name: "{{ resource_prefix }}_ansible_ec2_vol_info_test"
instance_type: t2.nano
image_id: "{{ (amis.images | sort(attribute='creation_date') | last).image_id }}"
wait: yes
@ -40,7 +40,7 @@
ec2_vol:
instance: "{{ instance.instance_ids[0] }}"
volume_size: 4
name: "{{ resource_prefix }}_ansible_ec2_vol_facts_test.db"
name: "{{ resource_prefix }}_ansible_ec2_vol_info_test.db"
device_name: /dev/xvdf
iops: 100
tags:
@ -50,7 +50,7 @@
register: volume
- name: Gather volume info without any filters
ec2_vol_facts:
ec2_vol_info:
<<: *aws_connection_info
register: volume_facts_wo_filters
check_mode: no
@ -61,10 +61,10 @@
- "volume_facts_wo_filters.volumes is defined"
- name: Gather volume info
ec2_vol_facts:
ec2_vol_info:
<<: *aws_connection_info
filters:
"tag:Name": "{{ resource_prefix }}_ansible_ec2_vol_facts_test.db"
"tag:Name": "{{ resource_prefix }}_ansible_ec2_vol_info_test.db"
register: volume_facts
check_mode: no
@ -84,7 +84,7 @@
- "v.size is defined and v.size == 4"
- "v.snapshot_id is defined and v.snapshot_id == ''"
- "v.status is defined and v.status == 'in-use'"
- "v.tags.Name is defined and v.tags.Name == resource_prefix + '_ansible_ec2_vol_facts_test.db'"
- "v.tags.Name is defined and v.tags.Name == resource_prefix + '_ansible_ec2_vol_info_test.db'"
- "v.tags['Tag Name with Space-and-dash'] == 'Tag Value with Space-and-dash'"
- "v.type is defined and v.type == 'io1'"
- "v.zone is defined and v.zone == instance.instances[0].placement.availability_zone"
@ -104,7 +104,7 @@
ec2_instance:
state: absent
filters:
"tag:Name": "{{ resource_prefix }}_ansible_ec2_vol_facts_test"
"tag:Name": "{{ resource_prefix }}_ansible_ec2_vol_info_test"
<<: *aws_connection_info
register: result
until: result is not failed

View file

@ -124,16 +124,16 @@
register: setup_sg
- name: find a suitable AMI
ec2_ami_facts:
ec2_ami_info:
owner: amazon
filters:
description: "Amazon Linux AMI* ECS *"
<<: *aws_connection_info
register: ec2_ami_facts
register: ec2_ami_info
- name: set image id fact
set_fact:
ecs_image_id: "{{ (ec2_ami_facts.images|first).image_id }}"
ecs_image_id: "{{ (ec2_ami_info.images|first).image_id }}"
- name: provision ec2 instance to create an image
ec2:

View file

@ -44,7 +44,7 @@
register: testing_subnet_b
- name: Get default security group id for vpc
ec2_group_facts:
ec2_group_info:
<<: *aws_connection_info
filters:
vpc-id: "{{ testing_vpc.vpc.id }}"

View file

@ -9,7 +9,7 @@
region: "{{ aws_region }}"
no_log: yes
- ec2_ami_facts:
- ec2_ami_info:
<<: *aws_connection_info
filters:
architecture: x86_64

View file

@ -11,7 +11,7 @@
region: "{{ aws_region }}"
no_log: yes
- ec2_ami_facts:
- ec2_ami_info:
<<: *aws_connection_info
filters:
architecture: x86_64

View file

@ -8,7 +8,7 @@
no_log: yes
- name: get image ID to create an instance
ec2_ami_facts:
ec2_ami_info:
filters:
architecture: x86_64
owner-id: '125523088429'

View file

@ -24,7 +24,7 @@ lib/ansible/modules/cloud/amazon/ec2_asg_lifecycle_hook.py E327
lib/ansible/modules/cloud/amazon/ec2_eip.py E322
lib/ansible/modules/cloud/amazon/ec2_eip.py E324
lib/ansible/modules/cloud/amazon/ec2_elb.py E326
lib/ansible/modules/cloud/amazon/ec2_elb_facts.py E323
lib/ansible/modules/cloud/amazon/ec2_elb_info.py E323
lib/ansible/modules/cloud/amazon/ec2_group.py E322
lib/ansible/modules/cloud/amazon/ec2_instance.py E324
lib/ansible/modules/cloud/amazon/ec2_lc.py E322