Closed oguya closed 7 years ago
Instead of doing integer comparisons on strings, we should use Ansible's version_compare() filter.
version_compare()
For example: Run a task on Ubuntu 14.04 hosts only
the old way; using strings
when: ansible_distribution_version == '14.04'
using version_compare()
when: ansible_distribution_version | version_compare('14.04', '==')
https://docs.ansible.com/ansible/playbooks_tests.html#version-comparison
Instead of doing integer comparisons on strings, we should use Ansible's
version_compare()
filter.For example: Run a task on Ubuntu 14.04 hosts only
the old way; using strings
when: ansible_distribution_version == '14.04'
using
version_compare()
when: ansible_distribution_version | version_compare('14.04', '==')
https://docs.ansible.com/ansible/playbooks_tests.html#version-comparison