# Present VS Absent. Order of tasks is different when creating or deleting. Conditionals workaround?

**URL:** <https://forum.ansible.com/t/present-vs-absent-order-of-tasks-is-different-when-creating-or-deleting-conditionals-workaround/17024>\
**Category:** Ansible Developer\
**Created:** [December 11, 2014, 1:08pm UTC](https://forum.ansible.com/t/present-vs-absent-order-of-tasks-is-different-when-creating-or-deleting-conditionals-workaround/17024 "2014-12-11T13:08:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![polfilm](https://avatars.discourse-cdn.com/v4/letter/p/bc8723/32.png) [@polfilm](https://forum.ansible.com/u/polfilm)\
**Post date:** [December 11, 2014, 1:08pm UTC](https://forum.ansible.com/t/present-vs-absent-order-of-tasks-is-different-when-creating-or-deleting-conditionals-workaround/17024/1 "2014-12-11T13:08:31Z")

</div>

Hi,

I hope someone here could shed some light on this. Below is a super simplified example using EC2 elements but this could happen with other elements obviously.

`

master\_state: present

Create Subnet  
state: {{ master\_state }}

Create RoutingTable  
state: {{ master\_state }}

`

So this is fine, now we switch master\_state to absent and script fails because RoutingTable needs to be erased first. (unless i get this script run in total reverse) is there a way to do this somehow? If I use Conditionals in combination with wait\_for I could probably rely on order of tasks in file when state=present (normal) and when state=absent add to Subnet wait\_for RoutingTable.id = null before trying to delete subnet.

Am I overcomplicating this? Is there an easy way to do this?

Peter.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [December 12, 2014, 12:10am UTC](https://forum.ansible.com/t/present-vs-absent-order-of-tasks-is-different-when-creating-or-deleting-conditionals-workaround/17024/2 "2014-12-12T00:10:17Z")

</div>

Hi Peter,

I’m not quite following the full example and may need some information such as seeing your playbook. That all being said, as this is a bit more of a user question than a development of the project question, can you post further info over on ansible-project?

Thanks!
