# with\_nested and when condition

**URL:** <https://forum.ansible.com/t/with-nested-and-when-condition/22515>\
**Category:** Ansible Project\
**Created:** [September 8, 2016, 7:54pm UTC](https://forum.ansible.com/t/with-nested-and-when-condition/22515 "2016-09-08T19:54:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@Adam](https://forum.ansible.com/u/Adam)\
**Post date:** [September 8, 2016, 7:54pm UTC](https://forum.ansible.com/t/with-nested-and-when-condition/22515/1 "2016-09-08T19:54:31Z")

</div>

I’m trying to write a play that allows for me to only build certain directories conditionally while using the with\_nested.

Here’s my variable dictionary:

```auto
routers:
  router1:
    hostname: adam
  router2:
    hostname: steve

```

```auto

```

```auto
Here's my play:

```
