diff --git a/tasks/main.yml b/tasks/main.yml index 96f5209..9528177 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,5 +1,6 @@ --- - import_tasks: tomcat-pkgs.yml +- import_tasks: tomcat-javamelody.yml - import_tasks: tomcat-admin.yml when: tomcat_install_admin - import_tasks: tomcat-jmx.yml diff --git a/tasks/tomcat-javamelody.yml b/tasks/tomcat-javamelody.yml new file mode 100644 index 0000000..1e51372 --- /dev/null +++ b/tasks/tomcat-javamelody.yml @@ -0,0 +1,33 @@ +--- +- name: Manage the javamelody installation + block: + - set_fact: + ansible_python_interpreter: /usr/bin/python3.6 + when: ansible_distribution_release == "trusty" + + - 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 repository_url=https://repo1.maven.org/maven2 + + - 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 repository_url=https://repo1.maven.org/maven2 + + - 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 + + - set_fact: + ansible_python_interpreter: /usr/bin/python + when: ansible_distribution_release == "trusty" + + when: tomcat_javamelody + tags: [ 'tomcat', 'tomcat_javamelody', 'tomcat_conf' ] + +- 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', 'tomcat_conf' ] diff --git a/tasks/tomcat-pkgs.yml b/tasks/tomcat-pkgs.yml index 2015317..8ab523f 100644 --- a/tasks/tomcat-pkgs.yml +++ b/tasks/tomcat-pkgs.yml @@ -84,28 +84,3 @@ when: tomcat_version >= 8 tags: [ 'tomcat', 'tomcat_conf' ] -- 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 repository_url=https://repo1.maven.org/maven2 - when: tomcat_javamelody | bool - tags: [ 'tomcat', 'tomcat_javamelody', 'tomcat_conf' ] - -- 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 repository_url=https://repo1.maven.org/maven2 - when: tomcat_javamelody | bool - tags: [ 'tomcat', 'tomcat_javamelody', 'tomcat_conf' ] - -- 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 | bool - tags: [ 'tomcat', 'tomcat_javamelody', 'tomcat_conf' ] - -- 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 | bool - tags: [ 'tomcat', 'tomcat_javamelody', 'tomcat_conf' ]