-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
installTomat.yml
72 lines (72 loc) · 2.1 KB
/
installTomat.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
64
65
66
67
68
69
70
71
72
- hosts: all
become: true
tasks:
- name: Install Java
yum:
name: java-1.8.0-openjdk
state: present
- name: add tomcatuser
user:
name: tomcat
shell: /sbin/nologin
- name: get_installer
get_url:
url: https://archive.apache.org/dist/tomcat/tomcat-7/v7.0.76/bin/apache-tomcat-7.0.76.tar.gz
dest: /tmp/
- name: copy
copy:
src: /tmp/apache-tomcat-7.0.76.tar.gz
dest: /usr/local/
remote_src: yes
- name: install
unarchive:
src: /usr/local/apache-tomcat-7.0.76.tar.gz
dest: /usr/local
remote_src: yes
- name: Change file ownership, group and permissions
file:
path: /usr/local/apache-tomcat-7.0.76
owner: tomcat
group: tomcat
recurse: yes
state: directory
- name: make tomcat symbolic
file:
src: /usr/local/apache-tomcat-7.0.76
dest: /usr/local/tomcat7
owner: tomcat
group: tomcat
state: link
- name: make tomcat.service
file:
path: /etc/systemd/system/tomcat.service
state: touch
- name: edit tomcat.service
blockinfile:
dest: /etc/systemd/system/tomcat.service
insertafter:
block: |
[Unit]
Description = Apache Tomcat 7
After = syslog.target network.target
[Service]
User = tomcat
Group = tomcat
Type = oneshot
PIDFile =/usr/local/apache-tomcat-7.0.76/tomcat.pid
RemainAfterExit = yes
ExecStart =/usr/local/apache-tomcat-7.0.76/bin/startup.sh
ExecStop =/usr/local/apache-tomcat-7.0.76/bin/shutdown.sh
ExecReStart =/usr/local/apache-tomcat-7.0.76/bin/shutdown.sh;/usr/local/apache-tomcat-7.0.76/bin/startup.sh
[Install]
WantedBy = multi-user.target
- name: chmod 755 tomcat.service
file:
path: /etc/systemd/system/tomcat.service
mode: 0755
- name: start tomcat
systemd:
name: tomcat.service
state: started
daemon_reload: yes
enabled: yes