--- - name: "configure name resolution" ansible.builtin.blockinfile: path: "{{ item[0] }}" insertbefore: "EOF" marker: "# {mark} ANSIBLE MANAGED BLOCK SYSTEM {{ item[1].key }} #" block: | {{ item[1].value.inet }} {{ item[1].key }} {{ item[1].value.inet6 }} {{ item[1].key }} with_nested: - "{{ system_gateway_hosts_files }}" - "{{ system_gateway_hosts_hosts | dict2items }}"