Hi All,

I am trying to append multiple values in same cell csv but not getting 
through.Could someone help here?

*Current output:*


Hostname     Disk Info 
testserver       sdd: 1.00 Gbsde: 1.00 Gb 

*Expected output:*

Hostname      Disk Info 
testserver        sdd: 1.00 Gb
                          sde: 1.00 Gb 

*Playbook:*

 - set_fact:
     my_devices: "{{ ansible_devices.keys()|select('match', 
'^sd(.*)$')|list }}"

 - name: show templating results
    set_fact:
       disk_size: "{{ lookup('template', 'template-test.j2') }}"

  - set_fact:
          csv_data: "{{ inventory_hostname }}, {{ disk_size }}"

  - lineinfile:
          path: /tmp/disks_info.csv
          insertafter: EOF
          line: "{{ csv_data }}"
          create: yes
          state: present
          mode: 0777
    connection: local

*Template:*

{%- for dev in my_devices -%}
{{ dev }}: {{ ansible_devices[dev].size }}
{%- endfor -%}

regards
Kumar

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1f139f44-a6eb-4f74-b675-31a1249847a6n%40googlegroups.com.

Reply via email to