Dear All,

I am executing the df -kh command saving the result in csv but result is 
not coming in proper csv format.

--------Playbook--------

---
- name: Generate the disk spacke in csvormat
  hosts: all
  tasks:
    - name: disk space
      shell: "df -kh"
      register: shell_output

    - set_fact: t1="{{ 
hostvars[inventory_hostname]['shell_output']['stdout_lines'] }}"
    - debug: var=t1
    - name: Generate Report
      template:
        src: hosts.j2
        dest: /tmp/host_report.csv
      delegate_to: localhost
      run_once: yes

-------template: -----------

#SNo., Filesystem, Size, Used, Avail, Use%, Mounted on

{% for hostnode in ansible_play_hosts  %}
{{ loop.index }},{{ t1  }},{{ hostnode }}

{% endfor %}

-please advice..

-- 
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/d54d0e93-606a-4990-b078-1259a008d60fn%40googlegroups.com.

Reply via email to