Sorry for being little ambiguous.
Here is the output of my file when I read it. It is all clubbed together with newline \n and no proper formatting.
===================================================================
more icx.txt
{"ansible_facts": {"ansible_net_gather_subset": ["config", "default"], "ansible_
net_config": "Current configuration:\n!\nver 08.0.90jT213\n!\nstack unit 1\n mo
dule 1 icx7150-c12-poe-port-management-module\n module 2 icx7150-2-copper-port-
2g-module\n module 3 icx7150-2-sfp-plus-port-20g-module\n stack-port 1/3/1\n
stack-port 1/3/2\n!\n!\n!\n!\n!\nvlan 1 name DEFAULT-VLAN by port\n!\n!\n!\n!\n!
\n!\n!\n!\n!\n!\n!\n!\n!\naaa authentication web-server default local\naaa authe
ntication login default local\nip dns domain-list
attlocal.net dynamic\nip dns s
erver-address 192.168.1.254(dynamic)\nip route
0.0.0.0/0 192.168.1.254 distance
254 dynamic\n!\nusername sameer password .....\n!\n!\n!\n!\n!\n!\n!\n!\n!\n!\n!\
n!\n!\n!\n!\ninterface management 1\n ip address 192.168.1.190 255.255.255.0 dyn
amic\n!\ninterface ethernet 1/3/1\n speed-duplex 1000-full\n!\ninterface etherne
t 1/3/2\n speed-duplex 1000-full\n!\n!\n!\n!\n!\n!\nno lldp run\n!\n!\n!\n!\n!\n
!\n!\nend", "ansible_net_version": "08.0.90jT213", "ansible_net_serialnum": "FEK
3239N0BM", "ansible_net_model": "Stackable ICX7150-C12-POE", "ansible_net_image"
: "SPR08090j.bin", "ansible_net_hostname": null, "ansible_net_data": "Copyright
(c) Ruckus Networks, Inc. All rights reserved.\n UNIT 1: compiled on Jan 5 2
021 at 21:08:45 labeled as SPR08090j\n (33554432 bytes) from Primary SPR080
90j.bin (Non-UFI)\n SW: Version 08.0.90jT213 \n Compressed Primary B
oot Code size = 786944, Version:10.1.14T225 (mnz10114)\n Compiled on Thu N
ov 15 12:59:22 2018\n\n HW: Stackable ICX7150-C12-POE\n========================
==================================================\nUNIT 1: SL 1: ICX7150-C12-2X
1G POE 12-port Management Module\n Serial #:FEK3239N0BM\n Software Pa
ckage: ICX7150_BASE_L3_SOFT_PACKAGE \n Current License: 2X1G \n P-A
SIC 0: type B160, rev 11 Chip BCM56160_B0\n===================================
=======================================\nUNIT 1: SL 2: ICX7150-2X1GC 2-port 2G M
odule\n=========================================================================
=\nUNIT 1: SL 3: ICX7150-2X10GF 2-port 20G Module\n=============================
=============================================\n 1000 MHz ARM processor ARMv7 88
MHz bus\n 8192 KB boot flash memory\n 2048 MB code flash memory\n 1024 MB DRAM\n
STACKID 1 system uptime is 3 hour(s) 1 minute(s) 1 second(s) \nThe system start
ed at 00:01:53 GMT+00 Sat Jan 01 2000\n\nThe system : started=cold start \n\n=
=========================================================================\n=====
===== WARNING: Boot-monitor version mismatch!!! ==========\n=========
= Please use \"show boot-monitor\" command for details ==========\n===========
===============================================================\n===============
=======================================================================\n=======
======== WARNING: FI image is not booted from UFI!!! ===============\
n====== Please download UFI image and reboot the system for full functionality
======\n=======================================================================
===============", "ansible_net_stacked_models": ["ICX7150-C12-2X1G"], "ansible_n
et_stacked_serialnums": ["FEK3239N0BM"]}, "failed": false, "changed": false}
=============================================================================
However on the task debug display it shows proper format. This is how I want the text file to be when I read from the file.
TASK [debug] *******************************************************************
[WARNING]: Persistent connection logging is enabled for 192.168.1.190. This
will log ALL interactions to /home/sameer/Documents/ansible.log and WILL NOT
redact sensitive configuration like passwords. USE WITH CAUTION!
ok: [192.168.1.190] =>
result:
ansible_facts:
ansible_net_config: |-
Current configuration:
!
ver 08.0.90jT213
!
stack unit 1
module 1 icx7150-c12-poe-port-management-module
module 2 icx7150-2-copper-port-2g-module
module 3 icx7150-2-sfp-plus-port-20g-module
stack-port 1/3/1
stack-port 1/3/2
!
!
!
!
!
vlan 1 name DEFAULT-VLAN by port
!
!
!
!
!
!
!
!
!
!
!
!
!
aaa authentication web-server default local
aaa authentication login default local
ip dns server-address 192.168.1.254(dynamic)
ip route
0.0.0.0/0 192.168.1.254 distance 254 dynamic
!
username sameer password .....
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface management 1
ip address 192.168.1.190 255.255.255.0 dynamic
!
interface ethernet 1/3/1
speed-duplex 1000-full
!
interface ethernet 1/3/2
speed-duplex 1000-full
!
!
!
!
!
!
no lldp run
!
!
!
!
!
!
!
end
ansible_net_data: |-
Copyright (c) Ruckus Networks, Inc. All rights reserved.
UNIT 1: compiled on Jan 5 2021 at 21:08:45 labeled as SPR08090j
(33554432 bytes) from Primary SPR08090j.bin (Non-UFI)
SW: Version 08.0.90jT213
Compressed Primary Boot Code size = 786944, Version:10.1.14T225 (mnz10114)
Compiled on Thu Nov 15 12:59:22 2018
HW: Stackable ICX7150-C12-POE
==========================================================================
UNIT 1: SL 1: ICX7150-C12-2X1G POE 12-port Management Module
Serial #:FEK3239N0BM
Software Package: ICX7150_BASE_L3_SOFT_PACKAGE
Current License: 2X1G
P-ASIC 0: type B160, rev 11 Chip BCM56160_B0
==========================================================================
UNIT 1: SL 2: ICX7150-2X1GC 2-port 2G Module
==========================================================================
UNIT 1: SL 3: ICX7150-2X10GF 2-port 20G Module
==========================================================================
1000 MHz ARM processor ARMv7 88 MHz bus
8192 KB boot flash memory
2048 MB code flash memory
1024 MB DRAM
STACKID 1 system uptime is 3 hour(s) 1 minute(s) 1 second(s)
The system started at 00:01:53 GMT+00 Sat Jan 01 2000
The system : started=cold start
==========================================================================
========== WARNING: Boot-monitor version mismatch!!! ==========
========== Please use "show boot-monitor" command for details ==========
==========================================================================
======================================================================================
=============== WARNING: FI image is not booted from UFI!!! ===============
====== Please download UFI image and reboot the system for full functionality ======
======================================================================================
ansible_net_gather_subset:
- config
- default
ansible_net_hostname: null
ansible_net_image: SPR08090j.bin
ansible_net_model: Stackable ICX7150-C12-POE
ansible_net_serialnum: FEK3239N0BM
ansible_net_stacked_models:
- ICX7150-C12-2X1G
ansible_net_stacked_serialnums:
- FEK3239N0BM
ansible_net_version: 08.0.90jT213
changed: false
failed: false