# block with with\_items for bulk DNS registration of hosts?

**URL:** <https://forum.ansible.com/t/block-with-with-items-for-bulk-dns-registration-of-hosts/26189>\
**Category:** Ansible Project\
**Created:** [December 1, 2017, 9:04pm UTC](https://forum.ansible.com/t/block-with-with-items-for-bulk-dns-registration-of-hosts/26189 "2017-12-01T21:04:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![burton](https://avatars.discourse-cdn.com/v4/letter/b/8e7dd6/32.png) [@burton](https://forum.ansible.com/u/burton)\
**Post date:** [December 1, 2017, 9:04pm UTC](https://forum.ansible.com/t/block-with-with-items-for-bulk-dns-registration-of-hosts/26189/1 "2017-12-01T21:04:46Z")

</div>

I have a dictionary of DNS host names that I need to register.

They’re higher level than just a host as I need to do cleanup too of older DNS names.

My idea was to have a block with a look which first tests via ‘dig’ to see if the name is already present, and if not, register the DNS via the dnsimple module

The problem is that blocks don’t support with\_items.

At least in 2.2 and I don’t see a note about this being added.

Is it in 2.4? I don’t see any notes about this.

Thoughts?

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [December 1, 2017, 9:25pm UTC](https://forum.ansible.com/t/block-with-with-items-for-bulk-dns-registration-of-hosts/26189/2 "2017-12-01T21:25:01Z")

</div>

What is supported is here  
[https://docs.ansible.com/ansible/latest/playbooks\_keywords.html#block](https://docs.ansible.com/ansible/latest/playbooks_keywords.html#block)

And with\_items is not one of them.

You don't need block, you can do this in one task.

Just dnssimple with with\_item and use the dig lookup[1] in the when:

[1] [https://docs.ansible.com/ansible/latest/playbooks\_lookups.html#the-dns-lookup-dig](https://docs.ansible.com/ansible/latest/playbooks_lookups.html#the-dns-lookup-dig)
