I wrote a simple role to detect certain package from all servers, and a software version:
- name: check installed software
package_facts:
manager: auto
- name: check installed version
set_fact:
software_version_installed: "{{ ansible_facts.packages['somePackage']| map(attribute='version') | first }}"
with_dict: "{{ ansible_facts.packages['somePackage'] }}"
register: openssl_versions
- name: Save to file
delegate_to: localhost
local_action:
module: lineinfile
dest: "/tmp/someList.txt"
line: "{{ ansible_hostname }} : {{ ansible_default_ipv4.address }} : {{ ansible_facts.packages['somePackage']| map(attribute='version') | first }}"
when: # HERE IM STUCKED
How I can write a conditional, that find only packages with version greater than f.e 2.X Tried to find it in docs, but without any success.
I know that there is no problem saving all to the file and just grep it.
All I expected is just a file with simple output:
hostname : ipv4 : package version