From af6fac7a36d69f3606c2c27000461840b7281484 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 4 Sep 2019 18:25:31 +0200 Subject: [PATCH] Fix the javamelody installation on tomcat. --- .../templates/tomcat-web.xml.j2 | 49 ++++++++++++++++++- library/roles/tomcat/tasks/tomcat-pkgs.yml | 24 +++++++-- .../roles/tomcat/templates/tomcat-web.xml.j2 | 49 ++++++++++++++++++- 3 files changed, 116 insertions(+), 6 deletions(-) diff --git a/library/roles/tomcat-multiple-instances/templates/tomcat-web.xml.j2 b/library/roles/tomcat-multiple-instances/templates/tomcat-web.xml.j2 index 9860409..d27fdfb 100644 --- a/library/roles/tomcat-multiple-instances/templates/tomcat-web.xml.j2 +++ b/library/roles/tomcat-multiple-instances/templates/tomcat-web.xml.j2 @@ -501,10 +501,57 @@ --> {% if tomcat_javamelody %} - + + + javamelody net.bull.javamelody.MonitoringFilter + + + log + true + + javamelody diff --git a/library/roles/tomcat/tasks/tomcat-pkgs.yml b/library/roles/tomcat/tasks/tomcat-pkgs.yml index 05ee5f2..e5203d1 100644 --- a/library/roles/tomcat/tasks/tomcat-pkgs.yml +++ b/library/roles/tomcat/tasks/tomcat-pkgs.yml @@ -79,12 +79,28 @@ when: tomcat_version >= 8 tags: [ 'tomcat', 'tomcat_javamelody' ] -- name: Install the javamelody war if the javamelody support is enabled - maven_artifact: artifact_id=javamelody-core version=latest group_id=net.bull.javamelody extension=jar dest={{ tomcat_catalina_home_dir }}/lib/javamelody-core.jar verify_checksum=always mode=0644 owner=root group=root +- name: Install the javamelody dependency jar into the Java shared libs directory + maven_artifact: artifact_id=jrobin version=latest group_id=org.jrobin extension=jar dest=/usr/share/java/jrobin.jar verify_checksum=always mode=0644 owner=root group=root when: tomcat_javamelody tags: [ 'tomcat', 'tomcat_javamelody' ] -- name: Remove the javamelody war if the javamelody support is disabled - file: dest={{ tomcat_catalina_home_dir }}/lib/javamelody-core.jar state=absent +- name: Install the javamelody-core jar into the Java shared libs directory + maven_artifact: artifact_id=javamelody-core version={{ tomcat_javamelody_version }} group_id=net.bull.javamelody extension=jar dest=/usr/share/java/javamelody-core.jar verify_checksum=always mode=0644 owner=root group=root + when: tomcat_javamelody + tags: [ 'tomcat', 'tomcat_javamelody' ] + +- name: Create a link to the the javamelody jar and its dependencies if the javamelody support is enabled + file: src=../../java/{{ item }} dest={{ tomcat_catalina_home_dir }}/lib/{{ item }} state=link owner=root group=root mode=0644 + with_items: + - javamelody-core.jar + - jrobin.jar + when: tomcat_javamelody + tags: [ 'tomcat', 'tomcat_javamelody' ] + +- name: Remove the javamelody jar and its dependencies if the javamelody support is disabled + file: dest={{ tomcat_catalina_home_dir }}/lib/{{ item }} state=absent + with_items: + - javamelody-core.jar + - jrobin.jar when: not tomcat_javamelody tags: [ 'tomcat', 'tomcat_javamelody' ] diff --git a/library/roles/tomcat/templates/tomcat-web.xml.j2 b/library/roles/tomcat/templates/tomcat-web.xml.j2 index 9860409..d27fdfb 100644 --- a/library/roles/tomcat/templates/tomcat-web.xml.j2 +++ b/library/roles/tomcat/templates/tomcat-web.xml.j2 @@ -501,10 +501,57 @@ --> {% if tomcat_javamelody %} - + + + javamelody net.bull.javamelody.MonitoringFilter + + + log + true + + javamelody