Hi Michael,
That was the problem:) I made the change and it works as expected
Thanks for your help
On Wednesday, October 8, 2014 2:45:26 PM UTC-4, Michael Peters wrote:
>
> 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] <javascript:>>
> 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] <javascript:>.
> > To post to this group, send email to [email protected]
> <javascript:>.
> > 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/92ab2f98-30ca-4017-ac4e-5077ae8e9a99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.