-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrest-playbook.yml
42 lines (42 loc) · 1.3 KB
/
rest-playbook.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
- hosts: "{{ machine }}"
become: no
tasks:
- name: Install git
become: yes
apt:
name: git
state: latest
update_cache: yes
- name: Install JDK
become: yes
apt:
name: openjdk-8-jdk
state: latest
- name: Install JRE
become: yes
apt:
name: openjdk-8-jre
state: latest
- name: Clone repository
git:
repo: https://github.com/spring-petclinic/spring-petclinic-rest.git
dest: ./rest
- name: Build REST
command:
cmd: './mvnw package -Dmaven.test.skip=true'
chdir: ./rest
- name: Check if port is free
register: busy_port
ignore_errors: true
command:
cmd: 'lsof -Pti :{{ rest_port }} -sTCP:LISTEN'
- name: Kill process occupying needed port
when: busy_port is succeeded
ignore_errors: yes
shell: 'kill {{ busy_port.stdout }} 2>/dev/null'
- name: Run REST
shell: >
nohup java -jar ./rest/target/spring-petclinic-rest-2.4.2.jar --server.port={{ rest_port }} \
--spring.profiles.active=mysql,spring-data-jpa \
--spring.datasource.url=jdbc:mysql://{{ mysql_user }}:{{ mysql_pass }}@{{ mysql_host }}:{{ mysql_port }}/{{ mysql_name }}?useUnicode=true \
> rest-`date -Iseconds`.out &