[ec2_ami_facts] new boto3-based module as a replacement for ec2_ami_find (#32252)

* [ec2_ami_facts] new boto3-based module as a replacement for ec2_ami_find

- new boto3-based module to gather facts about ec2 images
- intended to replace ec2_ami_find which uses boto
- an ami find task (using new module) added to the ec2_ami integration test

* [ec2_ami_facts] Use AnsibleAWSModule. Catch BotoCoreError.

* add ec2_ami_facts alias to tests

* [ec2_ami_facts] return ami launch permissions as well
This commit is contained in:
Prasad Katti 2017-11-01 15:56:58 -07:00 committed by Will Thames
parent e33c24f585
commit 86141c3e03
3 changed files with 254 additions and 0 deletions

View file

@ -1,2 +1,3 @@
cloud/aws
posix/ci/cloud/group1/aws
ec2_ami_facts

View file

@ -118,6 +118,23 @@
# ============================================================
- name: gather facts about the image created
ec2_ami_facts:
ec2_region: '{{ec2_region}}'
ec2_access_key: '{{ec2_access_key}}'
ec2_secret_key: '{{ec2_secret_key}}'
security_token: '{{security_token}}'
image_ids: '{{ ec2_ami_image_id }}'
register: ami_facts_result
ignore_errors: true
- name: assert that the right image was found
assert:
that:
- "ami_facts_result.images[0].image_id == ec2_ami_image_id"
# ============================================================
- name: delete the image
ec2_ami:
ec2_region: '{{ec2_region}}'