-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_war.yml
45 lines (36 loc) · 1.27 KB
/
install_war.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
- name : Playbook to deploy war file in tomcat
hosts: all
user: ubuntu
gather_facts: True
vars:
war_file: samplenew.war
tomcat_app: samplenew
tomcat_war_path: /opt/tomcat/webapps
tasks:
- name: Deploy war | Install necessary packages if missing
apt:
name: python3-pip
state: present
- name: Deploy war | Install python packages
pip:
name:
- boto3
- botocore
- name: Deploy war | Download war from AWS S3
s3:
bucket: projcts-artifacts
object: "{{jobname}}-{{buildno}}/jobs/{{jobname}}/{{buildno}}/{{war_file}}"
dest: "/tmp/{{war_file}}"
mode: get
- name: Deploy war | Change war permissions
shell: chmod 777 "/tmp/{{war_file}}"
- name: Deploy war | Remove old builds
shell: sudo rm -rf "{{tomcat_war_path}}/{{war_file}}" "{{tomcat_war_path}}/{{tomcat_app}}"
- name: Deploy war | Copy war file to tomcat webapps
shell: sudo cp "/tmp/{{war_file}}" "{{tomcat_war_path}}/{{war_file}}"
- name: Deploy war | Change war permissions
shell: chown tomcat:tomcat "{{tomcat_war_path}}/{{war_file}}"
- name: Deploy war | Restart tomcat service
service:
name: tomcat
state: restarted