Hi Team,
I have created a playbook to gather information from a Redhat KVM server.
The issue I am facing is that I am getting the entire message in a single
line. Can someone suggest a solution to print the message content as
individual lines instead of a single line.
play book
========
---
- hosts: all
tasks:
- name: Gathering Facts
setup:
- name: list all VMs
virt:
command: list_vms
register: all_vms
- name: list only running VMs
virt:
command: list_vms
state: running
register: running_vms
- name: Print All VM'state
debug:
msg: |
VM's: {{ all_vms.list_vms }},
Active VM's: {{ running_vms.list_vms }}
HOSTNAME: {{ ansible_hostname }}
FQDN: {{ ansible_fqdn }}
OS_Name: {{ ansible_distribution }}
OS_Version: {{ ansible_distribution_version }}
OS Architecture: {{ ansible_architecture }}
Virtualization: {{ ansible_virtualization_type }}
BIOS DATE: {{ ansible_bios_date }}
BIOS VERSION: {{ ansible_bios_version }}
PHYSICAL CPU: {{ ansible_processor_count }}
CPU CORE COUNT: {{ ansible_processor_vcpus }}
CPU_TYPE: {{ ansible_processor }}
VENDOR NAME: {{ ansible_product_name }}
PRODUCT_SERIAL: {{ ansible_product_serial }}
PRODUCT_UUID: {{ ansible_product_uuid }}
TOTAL MEMORY: {{ ansible_memtotal_mb }}
N/W Interface: {{ ansible_default_ipv4.interface }}
IPADDRESS: {{ ansible_default_ipv4.address }}
SUBNETMASK: {{ ansible_default_ipv4.netmask }}
GATEWAY: {{ ansible_default_ipv4.gateway }}
MACADDRESS: {{ ansible_default_ipv4.macaddress }}
N/W ADDRESS: {{ ansible_default_ipv4.network }}
output message
============
"msg": "VM's: [u'clus2.node.com', u'sol11test', u'win2019test', u'
clus1.node.com', u'RHEL8Test', u'RHEL7_ANSCtrl_SS_Test', u'SLES15Test',
u'cent8test', u'sol10test', u'win2016test', u'RHEL6.10_Test'],\nActive
VM's: [u'clus2.node.com', u'sol11test', u'win2019test', u'clus1.node.com',
u'RHEL8Test', u'RHEL7_ANSCtrl_SS_Test', u'SLES15Test', u'cent8test',
u'sol10test', u'win2016test'],\nHOSTNAME: y4420-500,\nFQDN:
y4420-500.aldm.sl.edst.ibm.com,\nOS_Name: RedHat\nOS_Version: 7.9\nOS
Architecture: x86_64\nVirtualization: kvm\nBIOS DATE: 05/10/2018\nBIOS
VERSION: 3.2\nPHYSICAL CPU: 1\nCPU CORE COUNT: 8\nCPU_TYPE: [u'0',
u'GenuineIntel', u'Intel(R) Xeon(R) CPU E3-1270 v3 @ 3.50GHz', u'1',
u'GenuineIntel', u'Intel(R) Xeon(R) CPU E3-1270 v3 @ 3.50GHz', u'2',
u'GenuineIntel', u'Intel(R) Xeon(R) CPU E3-1270 v3 @ 3.50GHz', u'3',
u'GenuineIntel', u'Intel(R) Xeon(R) CPU E3-1270 v3 @ 3.50GHz', u'4',
u'GenuineIntel', u'Intel(R) Xeon(R) CPU E3-1270 v3 @ 3.50GHz', u'5',
u'GenuineIntel', u'Intel(R) Xeon(R) CPU E3-1270 v3 @ 3.50GHz', u'6',
u'GenuineIntel', u'Intel(R) Xeon(R) CPU E3-1270 v3 @ 3.50GHz', u'7',
u'GenuineIntel', u'Intel(R) Xeon(R) CPU E3-1270 v3 @ 3.50GHz']\nVENDOR
NAME: PIO-518D-TLN4F-ST031\nPRODUCT_SERIAL: S14073214509412\nPRODUCT_UUID:
00000000-0000-0000-0000-002590D6BFE8\nTOTAL MEMORY: 15908\nN/W Interface:
bond0\nIPADDRESS: x.x.x.x\nSUBNETMASK: x.x.x.x\nGATEWAY:
x.x.x.x\nMACADDRESS: 00:25:90:d6:bf:e8\nN/W ADDRESS: x.x.x.x\n"
}
--
Regards,
Jayan
--
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/CAB7L2jTH5Ue0QrtJ9vOJ14gL_Uk5NWz4bDeYZ0Rvz6ddueb%2BoA%40mail.gmail.com.