# EC2 instances with tagged volumes that delete on termination

**URL:** <https://forum.ansible.com/t/ec2-instances-with-tagged-volumes-that-delete-on-termination/17906>\
**Category:** Ansible Project\
**Created:** [April 4, 2015, 3:00pm UTC](https://forum.ansible.com/t/ec2-instances-with-tagged-volumes-that-delete-on-termination/17906 "2015-04-04T15:00:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brenda\_Bell](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@Brenda\_Bell](https://forum.ansible.com/u/Brenda_Bell)\
**Post date:** [April 4, 2015, 3:00pm UTC](https://forum.ansible.com/t/ec2-instances-with-tagged-volumes-that-delete-on-termination/17906/1 "2015-04-04T15:00:36Z")

</div>

The subject says what I’m trying to do.

I first tried to create the instances with a volume dictionary, but that method doesn’t let me tag the volumes.

I then tried to first create the instances, then create the volumes and attach them, but that method doesn’t let me set them to delete on termination.

I finally attempted to create the instances one at a time with a volume dictionary, intending to loop through the volumes and tag them after the fact. But then I ran into the issue where I’m unable to invoke my create-one-instance include in a with\_sequential loop.

What am I missing? Or is there simply not a way to do this?

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [April 6, 2015, 9:04pm UTC](https://forum.ansible.com/t/ec2-instances-with-tagged-volumes-that-delete-on-termination/17906/2 "2015-04-06T21:04:38Z")

</div>

Hi Brenda, this has come up before a few times (including from our own QA testing team), but apparently we haven’t opened an issue on it to date. Feel free to do so, and we’ll take a look at getting it resolved. It’s definitely been a problem in the past.

Thanks!

---

<div class="post-metadata">

**Author:** ![Brenda\_Bell](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@Brenda\_Bell](https://forum.ansible.com/u/Brenda_Bell)\
**Post date:** [April 7, 2015, 1:25pm UTC](https://forum.ansible.com/t/ec2-instances-with-tagged-volumes-that-delete-on-termination/17906/3 "2015-04-07T13:25:14Z")

</div>

Thanks so much for the response. I’m new to Ansible, so what’s the right way to open an issue? I assume I just submit it to the git projects ([https://github.com/ansible/ansible/issues](https://github.com/ansible/ansible/issues)), right?

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [April 7, 2015, 1:28pm UTC](https://forum.ansible.com/t/ec2-instances-with-tagged-volumes-that-delete-on-termination/17906/4 "2015-04-07T13:28:11Z")

</div>

Yep, that’s it. Let us know if you have any further questions.

Thanks!

---

<div class="post-metadata">

**Author:** ![Brenda\_Bell](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@Brenda\_Bell](https://forum.ansible.com/u/Brenda_Bell)\
**Post date:** [April 8, 2015, 1:14am UTC](https://forum.ansible.com/t/ec2-instances-with-tagged-volumes-that-delete-on-termination/17906/5 "2015-04-08T01:14:55Z")

</div>

AHA! I found a work-around.

I create the untagged volumes at the same time I create the instances with the ec2 module. But if I then go back and attempt to create the same volumes with the ec2\_vol module using the same device names, it doesn’t create or change the volumes, but it _does_ give me back a result with all the volume IDs. I can then use the IDs to create my tags.

Messy, but it gives me what I want.
