block with with_items for bulk DNS registration of hosts?

17 views
Skip to first unread message

bur...@scalefastr.io

unread,
Dec 1, 2017, 4:04:46 PM12/1/17
to Ansible Project
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?

Kai Stian Olstad

unread,
Dec 1, 2017, 4:25:44 PM12/1/17
to ansible...@googlegroups.com
What is supported is here
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


--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages