As an update the problem seem to be somewhere in the template module as it shows the same error even after I remove the variable item from the jinja2 template
--- - name: Install and setup unison in nDeploy cluster master file: path=/root/.unison state=directory - name: debug this debug: "{{ item }}" with_items: "{{ groups['ndeployslaves'] }}" - name: create the unison preference file template: src: default.prf.j2 dest: "/root/.unison/{{ item }}.prf" with_items: "{{ groups['ndeployslaves'] }}" The output is as below TASK [unison_master : debug this] ********************************************** task path: /root/nDeploy/conf/nDeploy-cluster/roles/unison_master/tasks/main.yml:8 ok: [127.0.0.1] => (item=cpanel.sysally.net) => { "invocation": { "module_args": {}, "module_name": "debug" }, "item": "cpanel.sysally.net", "msg": "Hello world!" } TASK [unison_master : create the unison preference file] *********************** task path: /root/nDeploy/conf/nDeploy-cluster/roles/unison_master/tasks/main.yml:12 fatal: [127.0.0.1]: FAILED! => {"failed": true, "msg": "'item' is undefined"} Note that default.prf.j2 does not contain any variables now. Thanks in advance for any help on this. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a6d87a6c-9305-4cd0-87dd-10d736160d15%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.