-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathtomcat.yml
62 lines (52 loc) · 1.49 KB
/
tomcat.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
---
# This is my first playbook
# HEADER SECTION
- name: This playbook will create a file
hosts: webservers
vars:
java: java-1.8.0-openjdk-devel
url: http://mirrors.estointernet.in/apache/tomcat/tomcat-8/v8.5.41/bin/apache-tomcat-8.5.41.tar.gz
tomcat: apache-tomcat-8.5.41
# TASK SECTION
tasks:
- name: To install dependency
yum:
name: "{{ java }}"
state: installed
- name: To create a group
group:
name: tomcatadm
state: present
- name: To create a user
user:
name: tomcat
state: present
groups: tomcatadm
- name: to create a dir
file:
path: /opt/tomcat_logs
state: directory
mode: 0644
- name: To download apache tomcat
get_url:
url: "{{ url }}"
mode: 0755
dest: /opt/"{{ tomcat }}".tar.gz
backup: yes
timeout: 20
- name: To untar and unzip the package
unarchive:
src: /opt/"{{ tomcat }}".tar.gz
dest: /opt/
mode: 0755
remote_src: yes
- name: to fetch the server.xml file from remote servers
fetch:
src: /opt/apache-tomcat-8.5.37/conf/server.xml
dest: /opt/
- name: To update the apache tomcat config
copy:
src: /opt/playbooks/server.xml
dest: /opt/apache-tomcat-8.5.37/conf/server.xml
- name: To start apache tomcat
command: nohup /opt/apache-tomcat-8.5.37/bin/startup.sh &