Hi,
I have just started learning ansible. I have written a simple playbook which will create , delete a server using ansible’s ec2 module. I can also create a volume and attach it to a previously created instance.
Hi,
I have just started learning ansible. I have written a simple playbook which will create , delete a server using ansible’s ec2 module. I can also create a volume and attach it to a previously created instance.
The ec2 module as of version 1.3 supports a state=absent parameter which will terminate the instances (there is also an example attached to that module’s documentation here: http://www.ansibleworks.com/docs/modules.html#ec2). The ec2_vol does not yet support a state=absent parameter, so you will have to continue using manual commands to accomplish the detach/delete step. Feel free to create a github issue to request that as a feature for the ec2_vol module.
Thanks for the quick reply. I have another doubt. In my playbook, I have created volumes, attached it to previously created instances and registered them as ec2_vol variable. Now if I want to detach a volume via aws cli tools, I use the following play…
$ stderr: A client error (InvalidVolumeID.Malformed) occurred: Invalid id: “{{item.volumeId}}” (expecting “vol-…”)
So, my question is what should be the proper format to get volume-id of newly created volumes.