Hello team,

I am trying to register variable /setfacts and use it in jinja2 template
for printing the output but it says variable not define , Please can yo
suggest something what is missing
========================Playbook =====================
---

 - name: WinRM Test
   hosts: all
   tasks:
   - name: WinRMPing
     ping:
     register: out

   - name: debug
     debug: var=out
   - name: debug
     debug:
      msg: "{{ out.ping }}"
   - name: setfacts
     set_fact: mysnapshotname11="{{ out.ping }}"

   - name: debug
     debug:
      msg: "{{ mysnapshotname11 }}"
   - name: CSV File Output
     delegate_to: localhost
     template:
       src: generate_csv.j2
       dest: winping_info.csv

=========================
Jinja 2

[root@closvl2058 /]# cat generate_csv.j2
# generate_csv.j2

HostName, PingFailed
{% for each in groups['winupdates']  %}
#{{ hostvars[each].inventory_hostname }}, {{hostvars[each].mysnapshotname11
}}
{{ hostvars[each].mysnapshotname11 }}
{% endfor %}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAHKNjxpxFciPTqKgxJJbzLoJ4jpZd7rHFEgaGpGBgz4%3DzSSigg%40mail.gmail.com.

Reply via email to