Have you tried the following?

{{table.stdout_lines|join('\n') }} 

Not tested but sounds like it might do what you want.

Jon

On Monday, November 7, 2016 at 3:07:36 PM UTC, jean-christophe manciot 
wrote:
>
> Hi everyone,
>
> Considering a variable {{ table.stdout_lines ]] containing the following 
> when printing it out on the terminal:
> TASK [save_table : Printing the returned table] 
> *****************************************************************************************************************************
> ok: [IOSv_L2_10] => {
>     "table.stdout_lines": [
>         [
>             "Extended IP access list authorized-snmp-nms", 
>             "    10 permit ip host 172.21.100.1 host 172.21.100.210 log", 
>             "Extended IP access list preauth_ipv4_acl (per-user)", 
>             "    10 permit udp any any eq domain", 
>             "    20 permit tcp any any eq domain", 
>             "    30 permit udp any eq bootps any", 
>             "    40 permit udp any any eq bootpc", 
>             "    50 permit udp any eq bootpc any", 
>             "    60 deny ip any any", 
>             "IPv6 access list preauth_ipv6_acl (per-user)", 
>             "    permit udp any any eq domain sequence 10", 
>             "    permit tcp any any eq domain sequence 20", 
>             "    permit icmp any any nd-ns sequence 30", 
>             "    permit icmp any any nd-na sequence 40", 
>             "    permit icmp any any router-solicitation sequence 50", 
>             "    permit icmp any any router-advertisement sequence 60", 
>             "    permit icmp any any redirect sequence 70", 
>             "    permit udp any eq 547 any eq 546 sequence 80", 
>             "    permit udp any eq 546 any eq 547 sequence 90", 
>             "    deny ipv6 any any sequence 100"
>         ]
>     ]
> }
>
> I need to save those lines into a local file, easy right?
> - name: Saving "{{ item }}" into local file
>   local_action: copy content="{{ table.stdout_lines }}" dest="{{ dest_file 
> }}"
>
> Unfortunately, all newlines are lost rendering the file difficult to read:
> [["Extended IP access list authorized-snmp-nms", "    10 permit ip host 
> 172.21.100.1 host 172.21.100.210 log", "Extended IP access list 
> preauth_ipv4_acl (per-user)", "    10 permit udp any any eq domain", "   
>  20 permit tcp any any eq domain", "    30 permit udp any eq bootps any", " 
>    40 permit udp any any eq bootpc", "    50 permit udp any eq bootpc any", 
> "    60 deny ip any any", "IPv6 access list preauth_ipv6_acl (per-user)", " 
>    permit udp any any eq domain sequence 10", "    permit tcp any any eq 
> domain sequence 20", "    permit icmp any any nd-ns sequence 30", "   
>  permit icmp any any nd-na sequence 40", "    permit icmp any any 
> router-solicitation sequence 50", "    permit icmp any any 
> router-advertisement sequence 60", "    permit icmp any any redirect 
> sequence 70", "    permit udp any eq 547 any eq 546 sequence 80", "   
>  permit udp any eq 546 any eq 547 sequence 90", "    deny ipv6 any any 
> sequence 100"]]
>
> Anyone has a brilliant simple idea to save {{ table.stdout_lines }} with 
> all newlines in the file?
>

-- 
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/a297262e-ac11-410e-b011-06008556a417%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to