/
restart.yml
63 lines (58 loc) · 1.69 KB
/
restart.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
- name: check Tomcat PID file
stat: path="{{ catalina_base }}/tomcat.pid"
register: tomcat_pid
when:
- catalina_home is defined
- name: stop Tomcat (with PID file)
become: true
become_user: "{{ tomcat_owner }}"
environment:
CATALINA_BASE: "{{ catalina_base }}"
CATALINA_PID: "{{ catalina_base }}/tomcat.pid"
command: "{{ catalina_home }}/bin/catalina.sh stop 30 -force"
ignore_errors: True
when:
- catalina_home is defined
- tomcat_pid is not defined or tomcat_pid.stat.exists == True
- name: stop Tomcat (without PID file)
become: true
become_user: "{{ tomcat_owner }}"
environment:
CATALINA_BASE: "{{ catalina_base }}"
command: "{{ catalina_home }}/bin/catalina.sh stop 30 -force"
ignore_errors: True
when:
- catalina_home is defined
- tomcat_pid is not defined or tomcat_pid.stat.exists == False
- name: clean up Tomcat deployment files
become: true
become_user: "{{ tomcat_owner }}"
file: path={{ catalina_base }}/{{ item }} state=absent
with_items:
- webapps/ROOT
- work/
when:
- catalina_home is defined
tags:
- tomcat_cleanup
- name: start Tomcat
become: true
become_user: "{{ tomcat_owner }}"
environment:
CATALINA_BASE: "{{ catalina_base }}"
CATALINA_PID: "{{ catalina_base }}/tomcat.pid"
command: "nohup {{ catalina_home }}/bin/catalina.sh start"
when:
- catalina_home is defined
- not tomcat_foreground
- name: run Tomcat
become: true
become_user: "{{ tomcat_owner }}"
environment:
CATALINA_BASE: "{{ catalina_base }}"
CATALINA_PID: "{{ catalina_base }}/tomcat.pid"
command: "{{ catalina_home }}/bin/catalina.sh run"
when:
- catalina_home is defined
- tomcat_foreground