fix cleanup AMI Snapshots. Bug fixed https://github.com/ansible/ansible/issues/39541
This commit is contained in:
parent
aaf2f75d66
commit
7bfac9599d
|
@ -22,7 +22,7 @@
|
|||
when: not aws_region_env_var
|
||||
|
||||
- name: Gather facts about all AMIs with given tag.
|
||||
ec2_ami_facts:
|
||||
ec2_ami_info:
|
||||
profile: "{{ aws_profile }}"
|
||||
owners: self
|
||||
filters: "{{ ami_tag }}"
|
||||
|
@ -59,8 +59,7 @@
|
|||
profile: "{{ aws_profile }}"
|
||||
image_id: "{{ oldest_ami.image_id }}"
|
||||
state: absent
|
||||
# Bug in deleting snapshots : https://github.com/ansible/ansible/issues/39541
|
||||
#delete_snapshot: yes
|
||||
delete_snapshot: yes
|
||||
when: ami_list.images
|
||||
|
||||
- name: LOG action
|
||||
|
@ -69,14 +68,6 @@
|
|||
dest: "{{ log_destination }}"
|
||||
when: ami_list.images
|
||||
|
||||
- name: Cleanup AMI snapshots
|
||||
ec2_snapshot:
|
||||
profile: "{{ aws_profile }}"
|
||||
snapshot_id: "{{ item.ebs.snapshot_id }}"
|
||||
state: absent
|
||||
with_items: "{{ oldest_ami.block_device_mappings }}"
|
||||
when: ami_list.images
|
||||
|
||||
- name: LOG action
|
||||
lineinfile:
|
||||
line: "{{ ansible_date_time.iso8601 }} AMI CLEANUP - Removed snapshots: {{ item.ebs.snapshot_id }}"
|
||||
|
|
Loading…
Reference in a new issue