- name: Debug Git version
ansible.builtin.debug:
var: base_git_installed_version
- name: Assert Git version
ansible.builtin.assert:
that: "{{ base_git_installed_version|trim is version('1.7.1', 'gt') }}"
fail_msg: "Git version is not enought for ansible git plugin"
I’ve the following error message:
FAILED! => {“changed”: false, “msg”: “Task failed: The test plugin ‘ansible.builtin.version’ failed: Version comparison failed: ‘<’ not supported between instances of ‘str’ and ‘int’”}
I’ve tried many combinations : float filter on both arg inputs, str or int filters, with and without double quotes around the expression, single quotes around inputs. Nothing…
This part isn’t working. base_git_installed doesn’t exist. (Missing prior task?)
But beside that, you need to look at the base_git_installed_version.stdout or base_git_installed_version.stdout_lines[0] to get the datum you want.
- name: Assert Git version
ansible.builtin.assert:
that: "{{ base_git_installed_version.stdout_lines[0] is version('1.7.1', 'gt') }}"
fail_msg: "Git version is not enought for ansible git plugin"