Hi everyone,

I'm wondering if there is a simple way to display the value of on exact 
item for each row whatever the number of entries we have ?

I'll explain myself, I have an ouput which looks like this :

ok: [server1] => {
    "requirements": {
        "changed": false, 
        "msg": "All items completed", 
        "results": [
            {
                "_ansible_item_result": true, 
                "_ansible_no_log": false, 
                "_ansible_parsed": true, 
                "changed": false, 
                "invocation": {
                    "module_args": {
                        "conf_file": null, 
                        "disable_gpg_check": false, 
                        "disablerepo": null, 
                        "enablerepo": null, 
                        "exclude": null, 
                        "install_repoquery": true, 
                        "list": "first_package", 
                        "name": null, 
                        "state": "installed", 
                        "update_cache": false, 
                        "validate_certs": true
                    }, 
                    "module_name": "yum"
                }, 
                "item": "first_package", 
                "results": [
                    {
                        "arch": "x86_64", 
                        "epoch": "0", 
                        "name": "name_of_the_package", 
                        "nevra": "0:first_package", 
                        "release": "release_of_the_package", 
                        "repo": "repo", 
                        "version": "version_of_the_package", 
                        "yumstate": "available"
                    }
                ]
            }, 
            {
                "_ansible_item_result": true, 
                "_ansible_no_log": false, 
                "_ansible_parsed": true, 
                "changed": false, 
                "invocation": {
                    "module_args": {
                        "conf_file": null, 
                        "disable_gpg_check": false, 
                        "disablerepo": null, 
                        "enablerepo": null, 
                        "exclude": null, 
                        "install_repoquery": true, 
                        "list": "second_package", 
                        "name": null,     
                        "state": "installed", 
                        "update_cache": false, 
                        "validate_certs": true
                    }, 
                    "module_name": "yum"
                }, 
                "item": "second_package", 
                "results": [
                    {
                        "arch": "x86_64", 
                        "epoch": "0", 
                        "name": "name_of_the_package", 
                        "nevra": "0:second_package", 
                        "release": "release_of_the_package", 
                        "repo": "repo", 
                        "version": "version_of_the_package", 
                        "yumstate": "available"
                    }
                 ]


And with that output, i'd like to display the value of "yumstate" entry for 
all of the items, here we have two items, but we could have 3, 4 or more.

Within my playbook i tried to do something like this, but of course it 
doesn't work :

        - name: debug
          debug:
             var: 'requirements.results[*].results[*].yumstate'

I also tried with a loop, but I haven't found anything.

So does anyone have a clue to do this?

Thanks for your help

-- 
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/f0e53c74-2a1d-42d9-a9eb-b65d670ac9f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to