Skip to content

Commit

Permalink
add imdsv2 test image cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaps committed Oct 10, 2024
1 parent 0b8d21d commit 4a59e11
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/integration/targets/ec2_ami_instance/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@
that:
- imdsv2_info.images[0].imdsv2_enabled

- name: set image id fact for deletion later
ansible.builtin.set_fact:
ec2_ami_image_id_imdsv2: "{{ imdsv2_image.image_id }}"

always:
# ============================================================

Expand Down Expand Up @@ -403,6 +407,14 @@
wait: true
ignore_errors: true

- name: delete imdsv2 ami
amazon.aws.ec2_ami:
state: absent
image_id: "{{ ec2_ami_image_id_imdsv2 }}"
name: "{{ ec2_ami_name }}_imdsv2"
wait: true
ignore_errors: true

- name: delete ami
amazon.aws.ec2_ami:
state: absent
Expand Down

0 comments on commit 4a59e11

Please sign in to comment.