--- - name: Copy Docker compose file ansible.builtin.template: src: templates/docker_compose_template.yml.j2 dest: /home/install/ptaf/{{ app_config[app].TENANT_NAME }}/{{ app_config[app].TENANT_NAME }}-ptaf-agent{{ '%03d' | format(item) }}/docker-compose.yml with_items: "{{ range_list }}" register: compose_file ...