It seems you're trying to "double template". If you're inside of the
{{ }} markers you don't need further {{ }} templating. Trying
something like this:
debug: msg="Firmware needs to be updated"
when: "{{ firmware_version_on_server.stdout |
version_compare(firmware_version_desired,'<') }}"
On Wed, Oct 8, 2014 at 2:42 PM, Mzp45 <[email protected]> wrote:
> 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
>
> --
> 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/76886694-39f3-4504-8fe3-2d53e68d8e2c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
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/CAJQqANcvXLQaWHGLSNjuDp95SmcfA11im%3D5kiHW27wHkeERkBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.