would anyone have any suggestions on this

On Sunday, January 30, 2022 at 12:05:39 AM UTC+11 John Veliss wrote:

> I would like to include some ansible *"when"* conditions based on if a 
> software package is greater than a value, ie when a package is greater than 
> 8.2, perform a task such as stop a service, uninstall the package, copy a 
> file, install a new version of the package
>
> I have the below which shows the version of a package called "Double" if 
> found
>
> The results appear as this --> * 
> ansible_facts.packages['Double'][0].version: 8.2.2*
>
>    - name: Gather the Package facts
>       package_facts:
>         manager: auto
>       tags:
>         - dt-check
>
>     - name: "Double Found result"
>       debug: var=ansible_facts.packages['Double'][0].version
>       when: "'Double' in ansible_facts.packages"
>       register: dtversion
>       tags:
>         - dt-check
>
>     - debug:
>         var: dtversion
>       tags:
>         - dt-check
>
>     - name: "Double Not-found result"
>       debug:
>         msg: "Double NOT found"
>       when: "'Double' not in ansible_facts.packages"
>       register: notfound
>       tags:
>         - dt-check
>
>     - debug:
>         var: notfound
>       tags:
>         - dt-check
>
>
> Thanks in advance for any ideas that you may suggest to me
>

-- 
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/6ede3b54-c555-47e0-8b13-af544ff6a48an%40googlegroups.com.

Reply via email to