Hello,

I'm trying to determined if package is installed and what version
I have the following tasks

vars:
    cmk_version: 1.4.0p7

    - name: Check if check-mk-raw package is installed
      yum:
        list: installed
      register: yum_packages

    - name: Display cmk_installed_version
      debug:
        var: item
      with_items: "{{yum_packages|json_query(jsonquery)}}"
      vars:
        jsonquery: "results[?name=='check-mk-raw-{{cmk_version}}'].name"


how I can use jsonquery var that will grab anything that starts with 
check-mk-raw so I can test if package name containing check-mk-raw is 
installed.
Also what would be the best way to just extract the version/release only. 
if I use var  jsonquery: 
"results[?name=='check-mk-raw-{{cmk_version}}'].name" the result would 
be check-mk-raw-1.4.0p7. I will need to extract "1.4.0p7" value only

-- 
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/7ff64b62-a063-4a35-9ce1-1d0624cbd046%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to