It seems as though your `with_items` on your `template` task is indented
too far.  It should be indented to the same level as the word `template`.
Just like you have it for your debug command.

On Wed, May 25, 2016 at 11:34 AM, Anoop Alias <[email protected]>
wrote:

> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/a6d87a6c-9305-4cd0-87dd-10d736160d15%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/a6d87a6c-9305-4cd0-87dd-10d736160d15%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v_AHCVjhAfBQuDZJ23eVMBMfbNgKUTWsB0k9g6hH9gNEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to