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:
@ -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
|
||||
|
@ -63,7 +63,7 @@ server {
|
||||
# See: https://httpoxy.org/
|
||||
fastcgi_param HTTP_PROXY "";
|
||||
|
||||
{% if ansible_distribution_version == '16.04' %}
|
||||
{% if ansible_distribution_version | version_compare('16.04', '==') %}
|
||||
fastcgi_pass unix:/run/php/php7.0-fpm-{{ domain_name }}.sock;
|
||||
{% else %}
|
||||
fastcgi_pass unix:/var/run/php5-fpm-{{ domain_name }}.sock;
|
||||
|
Reference in New Issue
Block a user