diff --git a/tasks/main.yml b/tasks/main.yml index 4daf428..22db296 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -257,10 +257,21 @@ when: tomcat_use_systemd_unit tags: ['tomcat', 'tomcat_instances', 'tomcat_init'] +- name: Check if /usr/lib/systemd/system exists + ansible.builtin.stat: + path: /usr/lib/systemd/system + register: systemd_system_path + tags: ['tomcat', 'tomcat_instances', 'tomcat_init'] + +- name: Define the installation path of the systemd unit + ansible.builtin.set_fact: + systemd_unit_dest_dir: '{% if systemd_system_path.stat.exists %}/usr/lib/systemd/system{% else %}/etc/systemd/system{% endif %}' + tags: ['tomcat', 'tomcat_instances', 'tomcat_init'] + - name: Install the instances systemd unit ansible.builtin.template: src: tomcat-service.j2 - dest: "/usr/lib/systemd/system/tomcat-instance-{{ item.http_port }}.service" + dest: "{{ systemd_unit_dest_dir }}/tomcat-instance-{{ item.http_port }}.service" mode: "0644" owner: root group: root diff --git a/templates/catalina.properties.j2 b/templates/catalina.properties.j2 index 82ea145..af67553 100644 --- a/templates/catalina.properties.j2 +++ b/templates/catalina.properties.j2 @@ -124,7 +124,7 @@ org.apache.catalina.startup.ContextConfig.jarsToSkip= # Additional JARs (over and above the default JARs listed above) to skip when # scanning for TLDs. The list must be a comma separated list of JAR file names. -org.apache.catalina.startup.TldConfig.jarsToSkip=tomcat7-websocket.jar +org.apache.catalina.startup.TldConfig.jarsToSkip=tomcat-websocket.jar # # String cache configuration.