Here's the raw output; each item in the 'updates' list is defined by the 
value of the 'id' field. Normally this would be a key like 'item' where i 
could then specify, updates.item.title, right?

How can i get around this?

Cheers

ok: [host1] => {
    "available_updates": {
        "changed": true,
        "failed": false,
        "found_update_count": 2,
        "installed_update_count": 0,
        "reboot_required": false,
        "updates": {
            "749e3c7a-4779-4c14-bccd-2b608c39ddc9": {
                "id": "749e3c7a-4779-4c14-bccd-2b608c39ddc9",
                "installed": false,
                "kb": [
                    "3084905"
                ],
                "title": "Update for Windows Server 2012 R2 (KB3084905)"
            },
            "8832eabb-68ee-4ef9-b45e-b8fee94581b8": {
                "id": "8832eabb-68ee-4ef9-b45e-b8fee94581b8",
                "installed": false,
                "kb": [
                    "890830"
                ],
                "title": "Windows Malicious Software Removal Tool for 
Windows 8, 8.1, 10 and Windows Server 2012, 2012 R2, 2016 x64 Edition - 
November 2017 (KB890830)"
            },
},
}

On Friday, December 1, 2017 at 10:49:27 AM UTC+11, area0 wrote:
>
> Hi guys,
>
> I'm trying to return the following message; i basically want to display 
> the following message and only list the 'title' field for the available 
> update. The message should read;
>
> " host1 has 12 updates available. The following updates are available for 
> install:
>  - KB11222
>  - KB112232
>   etc
> "
>
> I've tried a bunch of permutations, with the latest shown below (which 
> doesn't work by the way).
>
> ---
> - hosts: all
>   gather_facts: no
>   vars:
>     win_update_categories:
>         - CriticalUpdates
>         - DefinitionUpdates
>         - SecurityUpdates
>         - Updates
>         - UpdateRollups
>   tasks:
>     - block:
>         - name: Checking for Available Windows Updates
>           win_updates:
>             category_names: "{{ win_update_categories }}"
>             state: searched
>           register: available_updates
>         - name: List missing Updates
>           debug: 
>             msg: "{{ inventory_hostname }} has {{ 
> available_updates.found_update_count }} updates available. The following 
> updates are available for install: {{ available_updates.contains.item }}"
>             with_items: "{{ title }}"
>
> Anyone know where i'm going wrong?
>
> Thanks in advance
>

-- 
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/0992051d-e18d-428e-83e4-19e8f6d98010%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to