diff --git a/tomcat-multiple-instances/defaults/main.yml b/tomcat-multiple-instances/defaults/main.yml index 6855f68d..b92ee1b2 100644 --- a/tomcat-multiple-instances/defaults/main.yml +++ b/tomcat-multiple-instances/defaults/main.yml @@ -76,6 +76,7 @@ tomcat_m_jmx_port: 8186 # The following works with jdk >= 7.0.25 only tomcat_m_jmx_disable_additional_ports: True tomcat_m_jmx_localhost_only: False +tomcat_m_jmx_ip_address: '{{ ansible_default_ipv4.address }}' #tomcat_m_jmx_auth_dir: '{{ tomcat_m_instances_base_path }}' # tomcat_m_jmx_monitorpass: define_in_a_vault_file diff --git a/tomcat-multiple-instances/templates/tomcat-default.j2 b/tomcat-multiple-instances/templates/tomcat-default.j2 index 628b4326..0501c1f4 100644 --- a/tomcat-multiple-instances/templates/tomcat-default.j2 +++ b/tomcat-multiple-instances/templates/tomcat-default.j2 @@ -33,7 +33,9 @@ JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.ssl=true" JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.ssl=false" {% endif %} {% if item.jmx_localhost_only is defined and item.jmx_localhost_only %} -JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.local.only=true" +JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.local.only=true -Djava.rmi.server.hostname=127.0.0.1" +{% else %} +JAVA_OPTS="${JAVA_OPTS} -Djava.rmi.server.hostname={{ tomcat_m_jmx_ip_address }}" {% endif %} {% if item.jmx_auth_enabled is defined and item.jmx_auth_enabled %} JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.password.file={{ item.jmx_auth_dir }}/jmxremote.password -Dcom.sun.management.jmxremote.access.file={{ item.jmx_auth_dir }}/jmxremote.access"