--- - name: Create services for dnscontrol hosts: localhost tasks: - name: Create the services json file ansible.builtin.template: src: "json.j2" dest: "{{ services_json_file }}" mode: "0644" vars: json: "{{ all_services | services_to_dnscontrol() }}"