Iterating Dictionaries with Ansible Roles
Nov 6 · 2 min read
I recently began re-working my infrastructure lab’s automation from scratch, and for my DNS server, I decided to take a simple approach: I want to define a hostname and address, and have it applied. Ansible supports a dictionary, key-value based data structure, so a definition like:
some-host:
some-key: some-value
some-other-key: some-other-valueis valid for use in an Ansible playbook, and iterable using the with_items syntax.

