-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathappserver.yml
65 lines (64 loc) · 1.75 KB
/
appserver.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
---
- hosts: all
become: yes
tasks:
- name: install java
apt:
name: openjdk-8-jdk
update_cache: yes
state: present
- name: Ensure group "tomcat" exists
group:
name: tomcat
state: present
- name: Add the user 'tomcat' with a specific uid and a primary group of 'tomcat'
user:
name: tomcat
comment: tomcat done
group: tomcat
- name: Download apache-tomcat-8.5.40.tar.gz
get_url:
url: https://www-eu.apache.org/dist/tomcat/tomcat-8/v8.5.39/bin/apache-tomcat-8.5.40.tar.gz
dest: /tmp/
- name: create a directory tomcat if not exists
file:
path: /opt/tomcat
state: directory
mode: 0755
- name: Extract archive
unarchive:
src: /tmp/apache-tomcat-8.5.40.tar.gz
dest: /opt/tomcat
extra_opts: [--strip-components=1]
remote_src: yes
- name: change th directory to /opt/tomcat
shell: cd /opt/tomcat
- name: Change ownership of Tomcat installation
file:
path: /opt/tomcat
owner: tomcat
group: tomcat
state: directory
mode: 0755
recurse: yes
- name: Configure Tomcat server
template:
src: tomcat-server.xml.j2
dest: /etc/systemd/system/
notify:
- restart tomcat
- name: remove tomcat-users.xml
file:
path: /opt/tomcat/conf/tomcat-user.xml
state: absent
- name: configure tomcat-user.xml
copy:
src: copy/tomcat-users.xml
dest: /opt/tomcat/conf/
notify:
- restart tomcat
handlers:
- name: tomcat-8-restart
service:
name: restart tomcat
state: restarted