Skip to content

Commit

Permalink
Place setenv when JAVA_HOME is set. (And export.)
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-de-bock committed Mar 3, 2025
1 parent efe65f6 commit c1cf094
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion tasks/instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
when:
- instance.java_opts is defined or
instance.xms is defined or
instance.xmx is defined
instance.xmx is defined or
instance.java_home is defined
notify:
- Restart tomcat instance

Expand Down
12 changes: 6 additions & 6 deletions templates/setenv.sh.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{ ansible_managed | comment }}

{% if instance.java_home is defined %}
JAVA_HOME="{{ instance.java_home }}"
PATH=$JAVA_HOME/bin:/$PATH
export JAVA_HOME="{{ instance.java_home }}"
export PATH=$JAVA_HOME/bin:/$PATH
{% endif %}

{% if instance.java_opts is defined %}
Expand All @@ -12,13 +12,13 @@ PATH=$JAVA_HOME/bin:/$PATH
{% endif %}

{% if instance.xmx is defined %}
JAVA_OPTS="-Xmx{{ instance.xmx }} ${JAVA_OPTS}"
export JAVA_OPTS="-Xmx{{ instance.xmx }} ${JAVA_OPTS}"
{% else %}
JAVA_OPTS="-Xmx{{ tomcat_xmx }} ${JAVA_OPTS}"
export JAVA_OPTS="-Xmx{{ tomcat_xmx }} ${JAVA_OPTS}"
{% endif %}

{% if instance.xms is defined %}
JAVA_OPTS="-Xms{{ instance.xms }} ${JAVA_OPTS}"
export JAVA_OPTS="-Xms{{ instance.xms }} ${JAVA_OPTS}"
{% else %}
JAVA_OPTS="-Xms{{ tomcat_xms }} ${JAVA_OPTS}"
export JAVA_OPTS="-Xms{{ tomcat_xms }} ${JAVA_OPTS}"
{% endif %}

0 comments on commit c1cf094

Please sign in to comment.