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