Hi,
I’m trying to compare 2 versions of firmware using the version_compare filter. When i use a variable like this it seems like it doesn’t evaluate the function correctly
debug: msg=“Firmware needs to be updated”
when: “{{ firmware_version_on_server.stdout | version_compare(‘{{ firmware_version_desired }}’,‘<’) }}”
However when i specify the actual version version it works
when: “{{ firmware_version_on_server.stdout | version_compare(‘2.31.5050’,‘<’) }}”
I added the strict=True syntax in the first case and i get the following error
when: “{{ firmware_version_on_server.stdout | version_compare(‘{{ firmware_version_desired }}’,‘<’,strict=True) }}”
fatal: [xxxxxxx] => Version comparison: invalid version number ‘{{firmware_version_desired}}’
Does the version_compare function not accept variables or is there some kind of string to integer conversion involved?
firmware_version_on_server.stdout is a registered variable obtained from a shell command
- name: Get firmware version of card
shell: “ethtool -i eth4 | grep firmware-version | awk ‘{print $NF}’”
register: firmware_version_on_server
Thanks