# vmware delete old snapshot

**URL:** <https://forum.ansible.com/t/vmware-delete-old-snapshot/29796>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [February 28, 2019, 7:15am UTC](https://forum.ansible.com/t/vmware-delete-old-snapshot/29796 "2019-02-28T07:15:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![itforumsubs](https://avatars.discourse-cdn.com/v4/letter/i/54ee81/32.png) [@itforumsubs](https://forum.ansible.com/u/itforumsubs)\
**Post date:** [February 28, 2019, 7:15am UTC](https://forum.ansible.com/t/vmware-delete-old-snapshot/29796/1 "2019-02-28T07:15:02Z")

</div>

Hi all,

May I ask how do you handle deleting old snapshots in vmware?

vmware\_guest\_snapshot module seems to be based on the name on the snapshot to manage. Im thinking of how to get the name of the snapshot based on the creation\_time if it’s older than certain days from vmware\_guest\_snapshot\_facts.

So this inquiry might go down to how do you compare timestamps from the output below?

{  
“creation\_time”: “2019-01-29T09:18:34.631273+00:00”,  
“description”: “”,  
“id”: 1,  
“name”: “test”,  
“state”: “poweredOn”  
},

I wish there’s a feature in vmware\_guest\_snapshot module to indicate deletion of snapshots that are older than certain days not just by name.

Thanks a lot in advance!

Regards,  
Rad

---

<div class="post-metadata">

**Author:** ![John\_Foley](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@John\_Foley](https://forum.ansible.com/u/John_Foley)\
**Post date:** [February 28, 2019, 5:14pm UTC](https://forum.ansible.com/t/vmware-delete-old-snapshot/29796/2 "2019-02-28T17:14:12Z")

</div>

Just delete them all 🙂

Having a slew of snapshots of bad business anyway.

---

<div class="post-metadata">

**Author:** ![itforumsubs](https://avatars.discourse-cdn.com/v4/letter/i/54ee81/32.png) [@itforumsubs](https://forum.ansible.com/u/itforumsubs)\
**Post date:** [March 4, 2019, 4:49am UTC](https://forum.ansible.com/t/vmware-delete-old-snapshot/29796/3 "2019-03-04T04:49:05Z")

</div>

Hi John,

Thanks for your reply.

I’m thinking of running the deletion of snapshots once or twice every week. Deleting them all every time would also delete the snapshot that are created just before the script runs if someone is working on their VM.

I can still do it using powerCLI script. Although i would prefer if it can be done via ansible.

Thanks!

Regards,  
Rad
