Use Ansible's version_compare instead of doing math on strings

I'm surprised this worked all these years actually. Since Ansible
version 1.6 it has been possible to use the version_compare filter
instead of doing math logic on strings.

See: https://docs.ansible.com/ansible/playbooks_tests.html
This commit is contained in:
2016-12-20 15:04:47 +02:00
parent 2ac931731a
commit 50536af990
6 changed files with 13 additions and 13 deletions

View File

@ -5,7 +5,7 @@
- name: Add GPG key for Extras repo
apt_key: id=0xC47415DFF48C09645B78609416126D3A3E5C1192 url=https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC47415DFF48C09645B78609416126D3A3E5C1192 state=present
when: ansible_distribution_version == '14.04'
when: ansible_distribution_version | version_compare('14.04', '==')
- name: Upgrade base OS
apt: upgrade=dist update_cache=yes