Change the tomcat roles so that we are now able to change the default temporary directory.

This commit is contained in:
Andrea Dell'Amico 2017-09-15 12:44:48 +02:00
parent bdfcf211d9
commit 33d3286e74
4 changed files with 18 additions and 2 deletions

View File

@ -56,6 +56,12 @@
register: tomcat_first_install
tags: [ 'tomcat', 'tomcat_instances' ]
- name: Create the tmp directory
file: dest={{ item.catalina_tmp_directory }} state=directory
with_items: '{{ tomcat_m_instances }}'
when: item.catalina_tmp_directory is defined
tags: [ 'tomcat', 'tomcat_instances' ]
- name: Populate the instances conf directory
copy: src={{ item[1] }} dest={{ item.0.instance_path }}/conf/{{ item[1] }} owner={{ item.0.user }} group={{ item.0.user }} mode=0640
with_nested:
@ -76,7 +82,6 @@
- tomcat restart instances with changed configs
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_catalina_properties' ]
- name: Populate the instances conf/policy.d directory
copy: src=policy.d/{{ item[1] }} dest={{ item.0.instance_path }}/conf/policy.d/{{ item[1] }} owner={{ item.0.user }} group={{ item.0.user }} mode=0640
with_nested:

View File

@ -50,6 +50,9 @@ JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address={{ item.re
{% endif %}
# WARNING: This directory will be destroyed and recreated at every startup !
JVM_TMP={{ item.instance_path }}/tmp
{% if item.catalina_tmp_directory is defined %}
export CATALINA_TMPDIR={{ item.catalina_tmp_directory }}
{% endif %}
# Additional options not managed by the provisioning tools
if [ -f /etc/default/tomcat-instance-{{ item.http_port }}.local ] ; then
. /etc/default/tomcat-instance-{{ item.http_port }}.local

View File

@ -9,6 +9,12 @@
notify: tomcat restart
tags: tomcat
- name: Create the catalina temp directory, if different from the default
file: dest={{ catalina_tmp_directory }} state=directory owner={{ tomcat_user }} group={{ tomcat_user }}
when: catalina_tmp_directory is defined
notify: tomcat restart
tags: tomcat
- name: Configure tomcat defaults
template: src=tomcat-default.j2 dest=/etc/default/tomcat{{ tomcat_version }}
when: tomcat_install_default_conf

View File

@ -48,7 +48,9 @@ JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address={{ tomcat_
# Location of the JVM temporary directory
# WARNING: This directory will be destroyed and recreated at every startup !
JVM_TMP={{ tomcat_tmp_dir }}
{% if catalina_tmp_directory is defined %}
export CATALINA_TMPDIR={{ catalina_tmp_directory }}
{% endif %}
{% if tomcat_load_additional_default_conf %}
if [ -f /etc/default/tomcat.local ] ; then
. /etc/default/tomcat.local