Hi
I'm trying to use version compare in selectattr but get error message
"Version comparison failed: '<' not supported between instances of 'int'
and 'str'
This is the playboot I'm using
- hosts: localhost
gather_facts: no
vars:
my:
- vers: "5.43"
- vers: "4.34"
tasks:
- debug:
msg: |
{{ my.0.vers is version("5", "<") }}
{{ my.1.vers is version("5", "<") }}
- debug:
msg:
{{ my | selectattr('vers', 'version', '"5", "<"' }}
The output I get is:
ansible-playboot test.yml
PLAY [localhost] *****
TASKĀ [debug] *****
OK: [localhost] => {}
MSG:
False
True
TASK [debug] *****
fatal: [localhost]: FAILED! => {}
MSG:
Version comparison failed: '<' not supported between instances of 'int'
and 'str'
Anyone have any idea how to do this?
--
Kai Stian Olstad
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/ad930d777fb18d83212fcac44e4c01f6%40olstad.com.