Created
September 9, 2019 20:20
-
-
Save neilus/aa735b0cfea566ad30fcec2223d57fb3 to your computer and use it in GitHub Desktop.
Comparing versions with ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Comparing Semantic versions | |
hosts: localhost | |
tasks: | |
- name: a < b | |
assert: | |
that: | |
- "{{ item.a is version_compare(item.b, '<') }}" | |
with_items: | |
- a: "6.6.6" | |
b: "7.0" | |
- a: "6.5.10" | |
b: "6.6" | |
- name: not a < b | |
assert: | |
that: | |
- "{{ item.a is not version_compare(item.b, '<') }}" | |
with_items: | |
- a: "7.0" | |
b: "6.9" | |
- a: "7.0.0" | |
b: "6.9.10" | |
- a: "6.7.6" | |
b: "6.6.7" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment