Use new syntax for Jinj2 filters that are used as tests

Ansible 2.5.0 uses a new syntax for Jinja2 filters that are used as
tests.

See: https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.5.html
This commit is contained in:
Alan Orth 2018-03-21 21:17:21 +02:00
parent 8adc1cb3bb
commit d155898bb1
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
5 changed files with 10 additions and 10 deletions

View File

@ -1,6 +1,6 @@
--- ---
- name: Install firewalld and deps - name: Install firewalld and deps
when: ansible_distribution_major_version | version_compare('8', '>=') when: ansible_distribution_major_version is version_compare('8', '>=')
apt: pkg={{ item }} state=present apt: pkg={{ item }} state=present
with_items: with_items:
- firewalld - firewalld
@ -8,11 +8,11 @@
tags: packages tags: packages
- name: Copy firewalld public zone file - name: Copy firewalld public zone file
when: ansible_distribution_major_version | version_compare('8', '>=') when: ansible_distribution_major_version is version_compare('8', '>=')
template: src=public.xml.j2 dest=/etc/firewalld/zones/public.xml owner=root mode=0600 template: src=public.xml.j2 dest=/etc/firewalld/zones/public.xml owner=root mode=0600
- name: Format public.xml firewalld zone file - name: Format public.xml firewalld zone file
when: ansible_distribution_major_version | version_compare('8', '>=') when: ansible_distribution_major_version is version_compare('8', '>=')
command: tidy -xml -iq -m -w 0 /etc/firewalld/zones/public.xml command: tidy -xml -iq -m -w 0 /etc/firewalld/zones/public.xml
notify: notify:
- reload firewalld - reload firewalld

View File

@ -1,6 +1,6 @@
--- ---
- name: Install firewalld and deps - name: Install firewalld and deps
when: ansible_distribution_version | version_compare('15.04', '>=') when: ansible_distribution_version is version_compare('15.04', '>=')
apt: pkg={{ item }} state=present apt: pkg={{ item }} state=present
with_items: with_items:
- firewalld - firewalld
@ -8,11 +8,11 @@
tags: packages tags: packages
- name: Copy firewalld public zone file - name: Copy firewalld public zone file
when: ansible_distribution_version | version_compare('15.04', '>=') when: ansible_distribution_version is version_compare('15.04', '>=')
template: src=public.xml.j2 dest=/etc/firewalld/zones/public.xml owner=root mode=0600 template: src=public.xml.j2 dest=/etc/firewalld/zones/public.xml owner=root mode=0600
- name: Format public.xml firewalld zone file - name: Format public.xml firewalld zone file
when: ansible_distribution_version | version_compare('15.04', '>=') when: ansible_distribution_version is version_compare('15.04', '>=')
command: tidy -xml -iq -m -w 0 /etc/firewalld/zones/public.xml command: tidy -xml -iq -m -w 0 /etc/firewalld/zones/public.xml
notify: notify:
- reload firewalld - reload firewalld

View File

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

View File

@ -64,7 +64,7 @@ server {
fastcgi_param HTTP_PROXY ""; fastcgi_param HTTP_PROXY "";
{# As of Ubuntu 16.04 and Debian 9, the PHP-FPM configs are the same #} {# As of Ubuntu 16.04 and Debian 9, the PHP-FPM configs are the same #}
{% if (ansible_distribution == 'Ubuntu' and ansible_distribution_version | version_compare('16.04', '==')) or (ansible_distribution == 'Debian' and ansible_distribution_major_version | version_compare('9', '==')) %} {% if (ansible_distribution == 'Ubuntu' and ansible_distribution_version is version_compare('16.04', '==')) or (ansible_distribution == 'Debian' and ansible_distribution_major_version | version_compare('9', '==')) %}
fastcgi_pass unix:/run/php/php7.0-fpm-{{ domain_name }}.sock; fastcgi_pass unix:/run/php/php7.0-fpm-{{ domain_name }}.sock;
{% else %} {% else %}
fastcgi_pass unix:/var/run/php5-fpm-{{ domain_name }}.sock; fastcgi_pass unix:/var/run/php5-fpm-{{ domain_name }}.sock;

View File

@ -4,7 +4,7 @@
- name: Configure php-fpm on Ubuntu and Debian 9 - name: Configure php-fpm on Ubuntu and Debian 9
import_tasks: Ubuntu.yml import_tasks: Ubuntu.yml
when: ansible_distribution == 'Ubuntu' or (ansible_distribution == 'Debian' and ansible_distribution_major_version | version_compare('9', '==')) when: ansible_distribution == 'Ubuntu' or (ansible_distribution == 'Debian' and ansible_distribution_major_version is version_compare('9', '=='))
tags: php-fpm tags: php-fpm
# vim: set ts=2 sw=2: # vim: set ts=2 sw=2: