Skip to content

Commit

Permalink
fix(ansible): deprecated warnings for | expression
Browse files Browse the repository at this point in the history
  • Loading branch information
gavindsouza committed Dec 4, 2019
1 parent fd7d59d commit 498e777
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions playbooks/roles/common/tasks/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions playbooks/roles/common/tasks/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -20,22 +20,22 @@
- 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:
pkg:
- 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:
pkg:
- 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')

...
4 changes: 2 additions & 2 deletions playbooks/roles/mariadb/tasks/debian.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
6 changes: 3 additions & 3 deletions playbooks/roles/nginx/tasks/setup-Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions playbooks/roles/packer/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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', '<'))
...

0 comments on commit 498e777

Please sign in to comment.