From f12038b2f13b9d4983b17e01cc9637d392e5b1af Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 19 Apr 2019 18:50:34 +0200 Subject: [PATCH] set the tomcat version at runtime. See https://support.d4science.org/issues/16551 --- tomcat/defaults/main.yml | 5 ++++- tomcat/tasks/tomcat-pkgs.yml | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/tomcat/defaults/main.yml b/tomcat/defaults/main.yml index ad7a98fb..60f41ee7 100644 --- a/tomcat/defaults/main.yml +++ b/tomcat/defaults/main.yml @@ -1,5 +1,8 @@ --- -tomcat_version: 7 +# The tomcat version is set at runtime. It changes from one distribution to the other. +#tomcat_version: 7 +# To force a tomcat version set the following variable: +# tomcat_fixed_version: 9 tomcat_pkg_state: present tomcat_service_enabled: True tomcat_pkgs: diff --git a/tomcat/tasks/tomcat-pkgs.yml b/tomcat/tasks/tomcat-pkgs.yml index 3cedab3f..56fd67db 100644 --- a/tomcat/tasks/tomcat-pkgs.yml +++ b/tomcat/tasks/tomcat-pkgs.yml @@ -1,4 +1,26 @@ --- +- name: Set the tomcat version for ubuntu Trusy + set_fact: + tomcat_version: 7 + when: + - ansible_distribution_major_version <= '16' + - tomcat_fixed_version is not defined + tags: tomcat + +- name: Set the tomcat version for Ubuntu bionic + set_fact: + tomcat_version: 8 + when: + - ansible_distribution_major_version == '18' + - tomcat_fixed_version is not defined + tags: tomcat + +- name: Impose a tomcat version + set_fact: + tomcat_version: '{{ tomcat_fixed_version }}' + when: tomcat_fixed_version is defined + tags: tomcat + - name: Install the tomcat packages apt: pkg={{ tomcat_pkgs }} state={{ tomcat_pkg_state }} tags: tomcat