From 7dc249bece7e0ea144eabfb331376df50fb4120d Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 23 Mar 2017 17:32:43 +0100 Subject: [PATCH] library/roles/tomcat-multiple-instances: Manage context.xml, for JNDI --- tomcat-multiple-instances/defaults/main.yml | 1 + tomcat-multiple-instances/tasks/main.yml | 9 ++++ .../templates/tomcat-context.xml.j2 | 54 +++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 tomcat-multiple-instances/templates/tomcat-context.xml.j2 diff --git a/tomcat-multiple-instances/defaults/main.yml b/tomcat-multiple-instances/defaults/main.yml index 8dac1fa..09a10e0 100644 --- a/tomcat-multiple-instances/defaults/main.yml +++ b/tomcat-multiple-instances/defaults/main.yml @@ -36,6 +36,7 @@ tomcat_m_webapps_autodeploy: False tomcat_m_webapps_unpack: False tomcat_m_start_instances: True tomcat_m_enable_instances: True +tomcat_m_jndi_pool: False # JMX and debugging tomcat_m_enable_remote_debugging: False diff --git a/tomcat-multiple-instances/tasks/main.yml b/tomcat-multiple-instances/tasks/main.yml index c8412cd..b456e9e 100644 --- a/tomcat-multiple-instances/tasks/main.yml +++ b/tomcat-multiple-instances/tasks/main.yml @@ -111,8 +111,17 @@ register: restart_needed notify: - tomcat restart instances with changed configs + when: tomcat_m_jndi_pool tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_default' ] +- name: Install a custom context.xml file + template: src=tomcat-context.xml.j2 dest={{ item.instance_path }}/conf/context.xml owner={{ item.user }} group={{ item.user }} mode=0640 + with_items: '{{ tomcat_m_instances }}' + register: restart_needed + notify: + - tomcat restart instances with changed configs + tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_contextxml' ] + - name: Install a logrotate entry for the access log file template: src=tomcat.logrotate.j2 dest=/etc/logrotate.d/tomcat_instance-{{ item.http_port }} owner=root group=root mode=0644 with_items: '{{ tomcat_m_instances }}' diff --git a/tomcat-multiple-instances/templates/tomcat-context.xml.j2 b/tomcat-multiple-instances/templates/tomcat-context.xml.j2 new file mode 100644 index 0000000..b2cd9e5 --- /dev/null +++ b/tomcat-multiple-instances/templates/tomcat-context.xml.j2 @@ -0,0 +1,54 @@ + + + + + + + WEB-INF/web.xml + + + + + + +{% if tomcat_m_jndi_pool %} + +