From 498e777b5745b3e939e42c0536ccb431c3f25804 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Wed, 4 Dec 2019 18:40:07 +0530 Subject: [PATCH] fix(ansible): deprecated warnings for | expression --- playbooks/roles/common/tasks/debian.yml | 4 ++-- playbooks/roles/common/tasks/ubuntu.yml | 8 ++++---- playbooks/roles/mariadb/tasks/debian.yml | 4 ++-- playbooks/roles/nginx/tasks/setup-Debian.yml | 6 +++--- playbooks/roles/packer/tasks/main.yml | 12 ++++++------ 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/playbooks/roles/common/tasks/debian.yml b/playbooks/roles/common/tasks/debian.yml index b057706c..14de785e 100644 --- a/playbooks/roles/common/tasks/debian.yml +++ b/playbooks/roles/common/tasks/debian.yml @@ -11,7 +11,7 @@ - tcl8.5-dev - tk8.5-dev state: present - when: ansible_distribution_version | version_compare('8', 'lt') + when: ansible_distribution_version is version_compare('8', 'lt') - name: install pillow prerequisites for Debian >= 8 apt: @@ -21,7 +21,7 @@ - tcl8.5-dev - tk8.5-dev state: present - when: ansible_distribution_version | version_compare('8', 'ge') + when: ansible_distribution_version is version_compare('8', 'ge') - name: install pdf prerequisites debian apt: diff --git a/playbooks/roles/common/tasks/ubuntu.yml b/playbooks/roles/common/tasks/ubuntu.yml index 20c76a0b..527e42c2 100644 --- a/playbooks/roles/common/tasks/ubuntu.yml +++ b/playbooks/roles/common/tasks/ubuntu.yml @@ -9,7 +9,7 @@ - tk8.5-dev state: present force: yes - when: ansible_distribution_version | version_compare('14.04', 'lt') + when: ansible_distribution_version is version_compare('14.04', 'lt') - name: install pillow prerequisites for Ubuntu >= 14.04 apt: @@ -20,7 +20,7 @@ - tk8.6-dev state: present force: yes - when: ansible_distribution_version | version_compare('14.04', 'ge') + when: ansible_distribution_version is version_compare('14.04', 'ge') - name: install pdf prerequisites for Ubuntu < 18.04 apt: @@ -28,7 +28,7 @@ - libssl-dev state: present force: yes - when: ansible_distribution_version | version_compare('18.04', 'lt') + when: ansible_distribution_version is version_compare('18.04', 'lt') - name: install pdf prerequisites for Ubuntu >= 18.04 apt: @@ -36,6 +36,6 @@ - libssl1.0-dev state: present force: yes - when: ansible_distribution_version | version_compare('18.04', 'ge') + when: ansible_distribution_version is version_compare('18.04', 'ge') ... \ No newline at end of file diff --git a/playbooks/roles/mariadb/tasks/debian.yml b/playbooks/roles/mariadb/tasks/debian.yml index 246aff59..6694f9e8 100644 --- a/playbooks/roles/mariadb/tasks/debian.yml +++ b/playbooks/roles/mariadb/tasks/debian.yml @@ -1,11 +1,11 @@ --- - name: Add apt key for mariadb for Debian <= 8 apt_key: keyserver=hkp://keyserver.ubuntu.com:80 id=0xcbcb082a1bb943db state=present - when: ansible_distribution_major_version | version_compare('8', 'le') + when: ansible_distribution_major_version is version_compare('8', 'le') - name: Add apt key for mariadb for Debian > 8 apt_key: keyserver=hkp://keyserver.ubuntu.com:80 id=0xF1656F24C74CD1D8 state=present - when: ansible_distribution_major_version | version_compare('8', 'gt') + when: ansible_distribution_major_version is version_compare('8', 'gt') - name: Add apt repository apt_repository: diff --git a/playbooks/roles/nginx/tasks/setup-Debian.yml b/playbooks/roles/nginx/tasks/setup-Debian.yml index 2f50fb37..375d1c3b 100644 --- a/playbooks/roles/nginx/tasks/setup-Debian.yml +++ b/playbooks/roles/nginx/tasks/setup-Debian.yml @@ -3,14 +3,14 @@ apt_key: url: http://nginx.org/keys/nginx_signing.key state: present - when: ansible_distribution == 'Debian' and ansible_distribution_version | version_compare('8', 'lt') + when: ansible_distribution == 'Debian' and ansible_distribution_version is version_compare('8', 'lt') - name: Add nginx apt repository for Debian < 8 apt_repository: repo: 'deb [arch=amd64,i386] http://nginx.org/packages/debian/ {{ ansible_distribution_release }} nginx' state: present - when: ansible_distribution == 'Debian' and ansible_distribution_version | version_compare('8', 'lt') - + when: ansible_distribution == 'Debian' and ansible_distribution_version is version_compare('8', 'lt') + - name: Ensure nginx is installed. apt: pkg: nginx diff --git a/playbooks/roles/packer/tasks/main.yml b/playbooks/roles/packer/tasks/main.yml index e31041ca..5b990583 100644 --- a/playbooks/roles/packer/tasks/main.yml +++ b/playbooks/roles/packer/tasks/main.yml @@ -10,28 +10,28 @@ when: packer.stat.exists - include_tasks: debian_family.yml - when: ansible_os_family == 'Debian' and packer.stat.exists == False + when: ansible_os_family == 'Debian' and packer.stat.exists == False - include_tasks: redhat_family.yml - when: ansible_os_family == "RedHat" and packer.stat.exists == False + when: ansible_os_family == "RedHat" and packer.stat.exists == False - name: Delete packer if < 1.2.1 file: state: absent path: /opt/packer - when: (packer.stat.exists) and (packer_version | version_compare('1.2.1', '<')) + when: (packer.stat.exists) and (packer_version is version_compare('1.2.1', '<')) - name: Download packer zip file command: chdir=/opt/ wget https://releases.hashicorp.com/packer/1.2.1/packer_1.2.1_linux_amd64.zip - when: (packer.stat.exists == False) or (packer_version | version_compare('1.2.1', '<')) + when: (packer.stat.exists == False) or (packer_version is version_compare('1.2.1', '<')) - name: Unzip the packer binary in /opt command: chdir=/opt/ unzip packer_1.2.1_linux_amd64.zip - when: (packer.stat.exists == False) or (packer_version | version_compare('1.2.1', '<')) + when: (packer.stat.exists == False) or (packer_version is version_compare('1.2.1', '<')) - name: Remove the downloaded packer zip file file: state: absent path: /opt/packer_1.2.1_linux_amd64.zip - when: (packer.stat.exists == False) or (packer_version | version_compare('1.2.1', '<')) + when: (packer.stat.exists == False) or (packer_version is version_compare('1.2.1', '<')) ... \ No newline at end of file