Hey I am trying to check the version on installed software on my VMs with Ansible.
Unfortunately I cant get the conditionals right.
Via the ansible_facts.packages
I get the version of the software but I am not sure about the comparing.
- hosts:
- os_linux
vars:
softwareVersion: "4.8.0-49"
tasks:
- name: Gather the package facts
ansible.builtin.package_facts:
manager: auto
- name: Check version of SoftwareX
ansible.builtin.debug:
msg: "OLD SoftwareX version: {{ ansible_facts.packages['SoftwareX'][0]['version'] }} found"
when: "ansible_facts.packages['SoftwareX'][0]['version'] <= {{ softwareVersion }}"