- name: install dnsmasq package apt: name: dnsmasq state: latest - name: add client hostnames and IP addresses to /etc/hosts lineinfile: dest: /etc/hosts line: "{{ item.1 }}\t{{ 'debian%03d' | format(item.0) }}" with_indexed_items: "{{ dhcp_list }}" notify: "restart dnsmasq" - name: configure dnsmasq template: src: dnsmasq-transparent-proxy.j2 dest: /etc/dnsmasq.d/transparent-proxy notify: "restart dnsmasq"