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 9860409f..d27fdfb5 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 05ee5f29..e5203d1c 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 9860409f..d27fdfb5 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