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

@ -22,7 +22,7 @@
# dependencies certbot checks for on its first run
# taken from running certbot right after a clean Ubuntu 16.04 install
- name: Install certbot dependencies (Ubuntu 16.04)
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '16.04'
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version | version_compare('16.04', '==')
apt: name={{ item }} state=present update_cache=yes
with_items:
- augeas-doc