Is this an option (using a list of messages), or are you looking for
something different?

- name: Print Upgrade Information
  debug:
    msg:
      - "Currently installed version: {{ current_version }} booting from {{
current_boot_loc[:-2] }}"
      - "New Image {{ new_v13_version }}  + {{ new_v13_build}} will be
uploaded from {{ new_image_dir }}"
      - "It will be installed to boot location '{{ dest_boot_loc }}'"


In the playbook that I use, it generates this

ok: [device-name] => {
    "msg": [
        "Currently installed version: 12.1.2 booting from HD1.1",
        "New Image 13.1.3 + 0.0.5' will be uploaded from ./UPGRADES/ISO'",
        "It will be installed to boot location HD1.3"
    ]
}
============================================================
i.e. - change yours to
 - name: Print All VM'state
    debug:
      msg:
        - VM's: {{ all_vms.list_vms }},
        - Active VM's: {{ running_vms.list_vms }}
        - HOSTNAME: {{ ansible_hostname }}

On Fri, May 28, 2021 at 3:46 AM Jayan Anirudhan <[email protected]> wrote:

> Any help in this issue will be highly appreciable.
>
> Regards,
> Jayan
>
> On Thu, May 27, 2021 at 9:41 PM Jayan Anirudhan <[email protected]>
> wrote:
>
>> Hi Dick,
>>
>> Thanks a lot for the reply. I added the entry to the ansible.cfg file and
>> found the issue persists. Message display is still the same as mentioned
>> below.
>>
>> ======================================
>>
>> "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
>>
>>
>> On Thu, May 27, 2021 at 8:32 PM Dick Visser <[email protected]>
>> wrote:
>>
>>> Try setting this in your ansible.cfg:
>>>
>>> stdout_callback = yaml
>>> bin_ansible_callbacks = True
>>>
>>> On Thu, 27 May 2021 at 16:55, Jayan Anirudhan <[email protected]>
>>> wrote:
>>> >
>>> > 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
>>> .
>>>
>>>
>>>
>>> --
>>> Dick Visser
>>> Trust & Identity Service Operations Manager
>>> GÉANT
>>>
>>> --
>>> 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/CAL8fbwMRuJPkfAKwLLq89%3DrgD%2BcdwXrdfG4nfrVvjgbg%3D%3Dc7Vw%40mail.gmail.com
>>> .
>>>
>>
>>
>> --
>> Regards,
>>
>> Jayan Anirudhan
>> Mob:09885994156
>>
>
>
> --
> Regards,
>
> Jayan Anirudhan
> Mob:09885994156
>
> --
> 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/CAB7L2jTg44GVJOGgD4sT0y8%3DumpkhWUHm7WRdYxcbG%3DH9bpJ2w%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAB7L2jTg44GVJOGgD4sT0y8%3DumpkhWUHm7WRdYxcbG%3DH9bpJ2w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAA92%3DYPtD2%3DC8up_FZpvLTVOR13-yjO5VPVF-3VNeYZQm9eWiw%40mail.gmail.com.

Reply via email to