Thanks Kai. The output is working fine, it's more about the formatting. For 
example, with the following debug code, i receive the following;

        - debug:
             msg: "{{ inventory_hostname }} has {{ 
available_updates.found_update_count }} updates available. 
                  {% for key, value in 
available_updates.updates.iteritems() %}
                - KB: {{ value.title }}
                  {% endfor %}"

ok: [host1] => {
    "msg": "host1 has 6 updates available.  - KB: Update for Windows Server 
2012 R2 (KB3013769)  - KB: Update for Windows Server 2012 R2 (KB3102429)  - 
KB: Update for Windows Server 2012 R2 (KB3013816)  - KB: Update for Windows 
Server 2012 R2 (KB3084905)  - KB: 2017-11 Preview of Monthly Quality Rollup 
for Windows Server 2012 R2 for x64-based Systems (KB4050946)  - KB: Windows 
Malicious Software Removal Tool for Windows 8, 8.1, 10 and Windows Server 
2012, 2012 R2, 2016 x64 Edition - November 2017 (KB890830) "
}

What i'd like, is for the output to be formatted as below;

ok: [host1] => {
    "msg": "host1 has 6 updates available.  
     - KB: Update for Windows Server 2012 R2 (KB3013769)  
     - KB: Update for Windows Server 2012 R2 (KB3102429)  
     - KB: Update for Windows Server 2012 R2 (KB3013816)  
     - KB: Update for Windows Server 2012 R2 (KB3084905)  
     - KB: 2017-11 Preview of Monthly Quality Rollup for Windows Server 
2012 R2 for x64-based Systems (KB4050946)  
     - KB: Windows Malicious Software Removal Tool for Windows 8, 8.1, 10 
and Windows Server 2012, 2012 R2, 2016 x64 Edition - November 2017 
(KB890830) "
}

Is this possible?

Thank you

On Monday, December 4, 2017 at 12:56:28 AM UTC+11, Kai Stian Olstad wrote:
>
> On 03.12.2017 11:49, area0 wrote: 
> > Any way we can format the output of the debug message as below i.e. 
> > have a 
> > KB per line? 
> > 
> > " host1 has 12 updates available. The following updates are available 
> > for 
> > install: 
> >  - KB11222 
> >  - KB112232 
> >   etc" 
>
> It should based on your output of the available_updates. 
> What are you seen and do you have the output of the variable that does 
> not give you that output? 
>
> If the "kb": field contains more than one element, my code will put them 
> in a comma separated sting. 
> If that is what you see, and just want all to be in one list this should 
> fix it. 
>
>    - debug: 
>        msg: | 
>          {{ inventory_hostname }} has {{ 
> available_updates.found_update_count }} updates available. The following 
> updates are available for install: 
>          {% for key, value in available_updates.updates.iteritems() %} 
>          {% for i in value.kb %} 
>          - {{ i }} 
>          {% endfor %} 
>          {% endfor %} 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ed49db48-fc96-4bba-9a68-d981e1998d86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to