EC2 - Delete on termination

Hello all,
I’ve been experimenting with the Ansible ec2 modules and I’m looking for a way to set the default volume created to have the “delete on termination” option set.

I found these volume options:

`
volumes:

  • device_name: /dev/sda1
    volume_size: 512
    delete_on_termination: true
    `

but this seems to create a secondary volume and only that one is set to delete on termination. How can I do the same thing for the volume created with the instance? I don’t want a secondary volume in this case.

Any help is appreciated, thanks!

I actually found that by specifying the volume as /dev/sda instead of /dev/sda1, it enables the “delete_on_termination” flag for the primary volume.

Hi Carlos,

We actually had someone bring this up in IRC the other day (perhaps it was you?), asking if they could pursue adding the option to delete the volumes as a specific parameter for the module too, so be on the lookout for that. Beyond that, if you continue seeing any problems with this, please let us know.

Thanks!

Hi James,
thanks for your reply. That actually was me!

I might still pursue adding the option as my first contribution as I’m trying to learn more about developing Ansible modules.