Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
use specified path instead of auto-generated
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Darashenka committed Aug 17, 2017
1 parent 0640f67 commit 8b5e2a1
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
241
242
13 changes: 7 additions & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
- "{{ tomcat_instance_dirs }}"
file:
state: directory
dest: "{{ item.0.path|default(tomcat_default_instance_path) }}/catalina/{{ item.0.name }}/{{ item.1 }}"
dest: "{{ item.0.path|default(tomcat_default_instance_path) }}/{{ item.1 }}"
owner: "{{ item.0.user|default(tomcat_default_user_name) }}"
group: "{{ item.0.group|default(tomcat_default_user_group) }}"
mode: 0755
Expand All @@ -161,6 +161,7 @@
-1
--ignore=web.xml
--ignore=server.xml
--ignore=tomcat-users.xml
{{ tomcat_env_catalina_home }}/conf

- name: Install static/unmanaged conf files
Expand All @@ -175,9 +176,9 @@
--group {{ item.0.group|default(tomcat_default_user_group) }}
--mode 0640
{{ tomcat_env_catalina_home }}/conf/{{ item.1 }}
{{ item.0.path|default(tomcat_default_instance_path) }}/catalina/{{ item.0.name }}/conf/{{ item.1 }}
{{ item.0.path|default(tomcat_default_instance_path) }}/conf/{{ item.1 }}
args:
creates: "{{ item.0.path|default(tomcat_default_instance_path) }}/catalina/{{ item.0.name }}/conf/{{ item.1 }}"
creates: "{{ item.0.path|default(tomcat_default_instance_path) }}/conf/{{ item.1 }}"


- name: Install instance server.xml
Expand All @@ -187,7 +188,7 @@
register: tomcat_registered_install_server_xml
template:
src: "{{ item.server_xml_template|default(tomcat_default_server_xml_template) }}"
dest: "{{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }}/conf/server.xml"
dest: "{{ item.path|default(tomcat_default_instance_path) }}/conf/server.xml"
owner: "{{ item.user|default(tomcat_default_user_name) }}"
group: "{{ item.group|default(tomcat_default_user_group) }}"
mode: 0640
Expand All @@ -199,7 +200,7 @@
register: tomcat_registered_install_web_xml
template:
src: "{{ item.web_xml_template|default(tomcat_default_web_xml_template) }}"
dest: "{{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }}/conf/web.xml"
dest: "{{ item.path|default(tomcat_default_instance_path) }}/conf/web.xml"
owner: "{{ item.user|default(tomcat_default_user_name) }}"
group: "{{ item.group|default(tomcat_default_user_group) }}"
mode: 0640
Expand All @@ -215,7 +216,7 @@
register: tomcat_registered_install_instance_environment_files
template:
src: service_systemd_envfile.j2
dest: "{{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }}/.systemd.conf"
dest: "{{ item.path|default(tomcat_default_instance_path) }}/.systemd.conf"
owner: "{{ item.user|default(tomcat_default_user_name) }}"
group: "{{ item.group|default(tomcat_default_user_group) }}"
mode: 0644
Expand Down
2 changes: 1 addition & 1 deletion templates/facts.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"instances": {
{% for instance in tomcat_instances %}
"{{ instance.name }}": {
"catalina_base": "{{ instance.path|default(tomcat_default_instance_path) }}/catalina/{{ instance.name }}",
"catalina_base": "{{ instance.path|default(tomcat_default_instance_path) }}",
"port": {
"shutdown": {{ instance.port_shutdown|default(tomcat_default_port_shutdown) }},
"connector": {{ instance.port_connector|default(tomcat_default_port_connector) }},
Expand Down
24 changes: 12 additions & 12 deletions templates/service_systemd.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ Environment=CATALINA_HOME={{ tomcat_env_catalina_home }}
{% if item.service_name|default(tomcat_default_service_name)|search('@') %}
EnvironmentFile=-{{ item.path|default(tomcat_default_instance_path) }}/catalina/%i/.systemd.conf
{% else %}
EnvironmentFile=-{{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }}/.systemd.conf
EnvironmentFile=-{{ item.path|default(tomcat_default_instance_path) }}/.systemd.conf
{% endif %}

ExecStart={{ ansible_local.java.general.java_home }}/bin/java \
{% if item.service_name|default(tomcat_default_service_name)|search('@') %}
-Djava.util.logging.config.file={{ item.path|default(tomcat_default_instance_path) }}/catalina/%i/conf/logging.properties \
{% else %}
-Djava.util.logging.config.file={{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }}/conf/logging.properties \
-Djava.util.logging.config.file={{ item.path|default(tomcat_default_instance_path) }}/conf/logging.properties \
{% endif %}
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
{% if item.prefer_urandom|default(tomcat_default_prefer_urandom) %}
Expand All @@ -32,14 +32,14 @@ ExecStart={{ ansible_local.java.general.java_home }}/bin/java \
-Djava.endorsed.dirs={{ tomcat_env_catalina_home }}/endorsed \
-Dcatalina.home={{ tomcat_env_catalina_home }} \
{% if item.service_name|default(tomcat_default_service_name)|search('@') %}
-Dcatalina.base={{ item.path|default(tomcat_default_instance_path) }}/catalina/%i \
-Dcatalina.base={{ item.path|default(tomcat_default_instance_path) }} \
{% else %}
-Dcatalina.base={{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }} \
-Dcatalina.base={{ item.path|default(tomcat_default_instance_path) }} \
{% endif %}
{% if item.service_name|default(tomcat_default_service_name)|search('@') %}
-Djava.io.tmpdir={{ item.path|default(tomcat_default_instance_path) }}/catalina/%i/temp \
-Djava.io.tmpdir={{ item.path|default(tomcat_default_instance_path) }}/temp \
{% else %}
-Djava.io.tmpdir={{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }}/temp \
-Djava.io.tmpdir={{ item.path|default(tomcat_default_instance_path) }}/temp \
{% endif %}
{% if item.prefer_ipv4|default(tomcat_default_prefer_ipv4) %}
-Djava.net.preferIPv4Stack=true \
Expand All @@ -52,9 +52,9 @@ ExecStart={{ ansible_local.java.general.java_home }}/bin/java \

ExecStop={{ ansible_local.java.general.java_home }}/bin/java \
{% if item.service_name|default(tomcat_default_service_name)|search('@') %}
-Djava.util.logging.config.file={{ item.path|default(tomcat_default_instance_path) }}/catalina/%i/conf/logging.properties \
-Djava.util.logging.config.file={{ item.path|default(tomcat_default_instance_path) }}/conf/logging.properties \
{% else %}
-Djava.util.logging.config.file={{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }}/conf/logging.properties \
-Djava.util.logging.config.file={{ item.path|default(tomcat_default_instance_path) }}/conf/logging.properties \
{% endif %}
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
{% if item.prefer_urandom|default(tomcat_default_prefer_urandom) %}
Expand All @@ -63,14 +63,14 @@ ExecStop={{ ansible_local.java.general.java_home }}/bin/java \
-Djava.endorsed.dirs={{ tomcat_env_catalina_home }}/endorsed \
-Dcatalina.home={{ tomcat_env_catalina_home }} \
{% if item.service_name|default(tomcat_default_service_name)|search('@') %}
-Dcatalina.base={{ item.path|default(tomcat_default_instance_path) }}/catalina/%i \
-Dcatalina.base={{ item.path|default(tomcat_default_instance_path) }} \
{% else %}
-Dcatalina.base={{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }} \
-Dcatalina.base={{ item.path|default(tomcat_default_instance_path) }} \
{% endif %}
{% if item.service_name|default(tomcat_default_service_name)|search('@') %}
-Djava.io.tmpdir={{ item.path|default(tomcat_default_instance_path) }}/catalina/%i/temp \
-Djava.io.tmpdir={{ item.path|default(tomcat_default_instance_path) }}/temp \
{% else %}
-Djava.io.tmpdir={{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }}/temp \
-Djava.io.tmpdir={{ item.path|default(tomcat_default_instance_path) }}/temp \
{% endif %}
{% if item.prefer_ipv4|default(tomcat_default_prefer_ipv4) %}
-Djava.net.preferIPv4Stack=true \
Expand Down
2 changes: 1 addition & 1 deletion templates/service_systemd_envfile.j2
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CATALINA_BASE={{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }}
CATALINA_BASE={{ item.path|default(tomcat_default_instance_path) }}
CATALINA_OPTS={{ item.catalina_opts|default(tomcat_default_catalina_opts) }}
4 changes: 2 additions & 2 deletions templates/service_sysvinit.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export TOMCAT_GROUP={{ item.group|default(tomcat_default_user_group ) }}
export JAVA_HOME={{ ansible_local.java.general.java_home }}
export PATH=${PATH}:${JAVA_HOME}/bin
export CATALINA_HOME={{ tomcat_env_catalina_home }}
export CATALINA_BASE={{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }}
export CATALINA_PID={{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }}/{{ item.name }}.pid
export CATALINA_BASE={{ item.path|default(tomcat_default_instance_path) }}
export CATALINA_PID={{ item.path|default(tomcat_default_instance_path) }}/{{ item.name }}.pid
export CATALINA_OPTS="{{ item.catalina_opts|default(tomcat_default_catalina_opts) }}"
{% if item.prefer_ipv4|default(tomcat_default_prefer_ipv4) %}
export CATALINA_OPTS="${CATALINA_OPTS} -Djava.net.preferIPv4Stack=true"
Expand Down
4 changes: 2 additions & 2 deletions templates/service_upstart.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ setgid {{ item.group|default(tomcat_default_user_group) }}

env JAVA_HOME={{ ansible_local.java.general.java_home }}
env CATALINA_HOME={{ tomcat_env_catalina_home }}
env CATALINA_BASE={{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }}
env CATALINA_BASE={{ item.path|default(tomcat_default_instance_path) }}
{% if item.prefer_ipv4|default(tomcat_default_prefer_ipv4) %}
env CATALINA_OPTS="{{ item.catalina_opts|default(tomcat_default_catalina_opts) }} -Djava.net.preferIPv4Stack=true"
{% else %}
Expand All @@ -25,5 +25,5 @@ script
end script

post-stop script
rm -rf {{ item.path|default(tomcat_default_instance_path) }}/catalina/{{ item.name }}/temp/*
rm -rf {{ item.path|default(tomcat_default_instance_path) }}/temp/*
end script

0 comments on commit 8b5e2a1

Please sign in to comment.