Skip to content

Commit

Permalink
Use compare() instead of version_compare()
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Angel committed Aug 12, 2020
1 parent e5c4993 commit a154fab
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions tasks/deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
url: https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280
id: "68576280"
state: present
when: "ansible_distribution_version is version_compare('16.04', '<=')"
when: "ansible_distribution_version is version('16.04', '<=')"

- name: "Add external repositories"
apt_repository:
repo: "{{ item }}"
update_cache: "yes"
with_items:
- "deb https://deb.nodesource.com/node_5.x {{ ansible_distribution_release }} main"
when: "ansible_distribution_version is version_compare('16.04', '<=')"
when: "ansible_distribution_version is version('16.04', '<=')"

- name: "Add archivematica/externals-dev PPA (ffmpeg in Ubuntu <= 14.04)"
apt_repository:
repo: "ppa:archivematica/externals-dev"
update_cache: "yes"
when: "ansible_distribution_version is version_compare('14.04', '<=')"
when: "ansible_distribution_version is version('14.04', '<=')"

- name: "Install AtoM dependencies (Ubuntu <= Xenial/16.04)"
apt:
Expand All @@ -39,7 +39,7 @@
- "python-pip" #
- "python-setuptools" #
- "openjdk-8-jre-headless" # Needed by FOP
when: "ansible_distribution_version is version_compare('16.04', '<=')"
when: "ansible_distribution_version is version('16.04', '<=')"

- name: "Install AtoM dependencies (Ubuntu >= Bionic/18.04)"
apt:
Expand All @@ -56,7 +56,7 @@
- "python-pip" #
- "python-setuptools" #
- "openjdk-8-jre-headless" # Needed by FOP
when: "ansible_distribution_version is version_compare('18.04', '>=')"
when: "ansible_distribution_version is version('18.04', '>=')"

- name: "Install Sphinx"
pip:
Expand Down
10 changes: 5 additions & 5 deletions tasks/fop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
apt:
pkg: "fop"
state: "latest"
when: "ansible_distribution_version is version_compare('18.04', '==')"
when: "ansible_distribution_version is version('18.04', '==')"
tags:
- "atom-fop"

- name: "Use FOP 2.1 in AtoM 2.3 or newer (Ubuntu 16.04 or RH)"
set_fact:
fop_version: "2.1"
when: ( ansible_distribution_version is version_compare('16.04', '==') ) or
when: ( ansible_distribution_version is version('16.04', '==') ) or
( ansible_os_family == "RedHat" )
tags:
- "atom-fop"

- name: "Use FOP 1.0 in AtoM 2.2 (Ubuntu 14.04)"
set_fact:
fop_version: "1.0"
when: "ansible_distribution_version is version_compare('14.04', '==')"
when: "ansible_distribution_version is version('14.04', '==')"
tags:
- "atom-fop"

Expand All @@ -44,7 +44,7 @@
src: "/usr/share/fop-{{ fop_version }}/fop"
dest: "/usr/local/bin/fop"
state: "link"
when: ( ansible_distribution_version is version_compare('16.04', '<=') ) or
when: ( ansible_distribution_version is version('16.04', '<=') ) or
( ansible_os_family == "RedHat" )
tags:
- "atom-fop"
Expand All @@ -55,5 +55,5 @@
path: "/etc/ImageMagick-6/policy.xml"
state: "absent"
regexp: 'PDF" />$'
when: "ansible_distribution_version is version_compare('16.04', '>=')"
when: "ansible_distribution_version is version('16.04', '>=')"

4 changes: 2 additions & 2 deletions tasks/php-pool-cfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
- "Restart PHP service"
when:
- ansible_distribution == "Ubuntu"
- "ansible_distribution_version is version_compare('14.04', '==')"
- "ansible_distribution_version is version('14.04', '==')"

- name: "Configure php-fpm pool (Ubuntu >= 16.04)"
block:
Expand All @@ -36,7 +36,7 @@
notify:
- "Restart PHP service"
when:
- "ansible_distribution_version is version_compare('16.04', '>=')"
- "ansible_distribution_version is version('16.04', '>=')"
- ansible_distribution == "Ubuntu"

- name: "Configure php-fpm pool (RH)"
Expand Down
2 changes: 1 addition & 1 deletion tasks/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
lineinfile:
dest: "/etc/init/php5-fpm.conf"
line: "reload signal USR2"
when: "ansible_distribution_version is version_compare('14.04', '==')"
when: "ansible_distribution_version is version('14.04', '==')"
2 changes: 1 addition & 1 deletion templates/etc/php/5/fpm/pool.d/atom.conf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ php_admin_value[apc.shm_size] = 192M
php_admin_value[apc.num_files_hint] = 5000
php_admin_value[apc.stat] = {% if atom_environment_type == 'development' %}1{% else %}0{% endif %}

{% if ansible_distribution_version is version_compare('14.04', '>=') %}
{% if ansible_distribution_version is version('14.04', '>=') %}
; Zend OPcache
php_admin_value[opcache.enable] = 1
php_admin_value[opcache.enable_cli] = 0
Expand Down
2 changes: 1 addition & 1 deletion templates/etc/php/7.0/fpm/pool.d/atom.conf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ php_admin_value[apc.shm_size] = 192M
php_admin_value[apc.num_files_hint] = 5000
php_admin_value[apc.stat] = {% if atom_environment_type == 'development' %}1{% else %}0{% endif %}

{% if ansible_distribution_version is version_compare('14.04', '>=') %}
{% if ansible_distribution_version is version('14.04', '>=') %}
; Zend OPcache
php_admin_value[opcache.enable] = 1
php_admin_value[opcache.enable_cli] = 0
Expand Down

0 comments on commit a154fab

Please sign in to comment.