1
0
mirror of https://github.com/containers/bootc.git synced 2026-02-05 06:45:13 +01:00
Files
bootc/tests/integration/playbooks/remove.yaml
Xiaofeng Wang cd7e62d5aa test: add integration test
Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2024-03-06 17:10:43 +08:00

37 lines
1009 B
YAML

---
- hosts: cloud
gather_facts: false
become: false
tasks:
- name: Remove AWS resources
block:
- name: terminate instance
amazon.aws.ec2_instance:
instance_ids: "{{ instance_id }}"
state: absent
wait: true
ignore_errors: true
- name: wait until instance terminated
amazon.aws.ec2_instance_info:
instance_ids:
- "{{ instance_id }}"
register: result_instance_status
retries: 30
delay: 10
until: result_instance_status.instances[0].state.name == "terminated"
- name: remove ec2 key
amazon.aws.ec2_key:
name: "kp-bootc-{{ random_num }}"
state: absent
- name: Deregister AMI (delete associated snapshots too)
amazon.aws.ec2_ami:
image_id: "{{ ami_id }}"
delete_snapshot: true
state: absent
when: ami_id != ""
when: platform == "aws"