How I can destroy asnible generated resources in AWS with a playbook?

36 views
Skip to first unread message

Aamir Saleem

unread,
Sep 5, 2019, 1:11:06 PM9/5/19
to Ansible Development
How I can destroy asnible generated resources in AWS with a playbook?

Actually, as we can removed all the resources created by terraforms by single script, can I do same with ansible? 

Mike Sawyers

unread,
Sep 5, 2019, 2:51:30 PM9/5/19
to Aamir Saleem, Ansible Development
If you created resources using cloud formation templates it should be clean enough to delete them in the same way. 

Otherwise I would think you would need logic to find the resources and remove them one by one. 

Like if your stack resources include a build number tag or git commit hash as an example then you could search for resources with that tag and delete them.

But by default ansible doesn't keep a state file like terraform so it doesn't just know what should tear down.


On Thu, Sep 5, 2019, 10:11 AM Aamir Saleem <aamirsa...@gmail.com> wrote:
How I can destroy asnible generated resources in AWS with a playbook?

Actually, as we can removed all the resources created by terraforms by single script, can I do same with ansible? 

--
You received this message because you are subscribed to the Google Groups "Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/185b36aa-373a-4bf6-ba16-f426984ac03d%40googlegroups.com.

Aamir Saleem

unread,
Sep 5, 2019, 3:36:49 PM9/5/19
to Ansible Development
Can I instantiate terraforms scripts by ansible?


On Thursday, September 5, 2019 at 11:51:30 PM UTC+5, Mike Sawyers wrote:
If you created resources using cloud formation templates it should be clean enough to delete them in the same way. 

Otherwise I would think you would need logic to find the resources and remove them one by one. 

Like if your stack resources include a build number tag or git commit hash as an example then you could search for resources with that tag and delete them.

But by default ansible doesn't keep a state file like terraform so it doesn't just know what should tear down.


On Thu, Sep 5, 2019, 10:11 AM Aamir Saleem <aamirsa...@gmail.com> wrote:
How I can destroy asnible generated resources in AWS with a playbook?

Actually, as we can removed all the resources created by terraforms by single script, can I do same with ansible? 

--
You received this message because you are subscribed to the Google Groups "Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansibl...@googlegroups.com.

Mike Sawyers

unread,
Sep 5, 2019, 3:53:15 PM9/5/19
to Aamir Saleem, Ansible Development
There is a module for terraform or command actions, so if you meet those requirement I don't see why not. 




To unsubscribe from this group and stop receiving emails from it, send an email to ansible-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/d9532e2e-7b8a-4a6f-a3ff-90a6c6900774%40googlegroups.com.

Aamir Saleem

unread,
Sep 6, 2019, 1:41:36 PM9/6/19
to Ansible Development
Mean I need to install anisble and Terraform both on same VM?

Mike Sawyers

unread,
Sep 6, 2019, 2:28:19 PM9/6/19
to Aamir Saleem, Ansible Development
That is my reading of the module yes.  The controller executing the tf template must also have terraform installed and likely in the environment path.  


To unsubscribe from this group and stop receiving emails from it, send an email to ansible-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/076f8d3c-ed6d-4d32-8119-df01d0e26cce%40googlegroups.com.

Aamir Saleem

unread,
Sep 6, 2019, 2:41:36 PM9/6/19
to Ansible Development
Reply all
Reply to author
Forward
0 new messages