mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-27 01:45:49 +00:00
added changes
This commit is contained in:
parent
3f74d6859a
commit
a7d61bb1a0
4 changed files with 39 additions and 80 deletions
11
ansible/madhuri.service
Normal file
11
ansible/madhuri.service
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[Unit]
|
||||||
|
Description=my springpetclinic application
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=ubuntu
|
||||||
|
WorkingDirectory=/home/jenkins
|
||||||
|
ExecStart=/usr/lib/jvm/java-17-openjdk-amd64/bin/java -jar /tmp/spring-petclinic-2.7.3.jar
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
28
ansible/spc.yaml
Normal file
28
ansible/spc.yaml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
---
|
||||||
|
- name: install springpetclinic
|
||||||
|
hosts: all
|
||||||
|
become: yes
|
||||||
|
tasks:
|
||||||
|
- name: install java17 and maven
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- openjdk-17-jdk
|
||||||
|
- maven
|
||||||
|
state: present
|
||||||
|
update_cache: yes
|
||||||
|
- name: get url from s3 bucket
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: https://neelu-madhu.s3.ap-south-1.amazonaws.com/spring-petclinic-3.0.0-SNAPSHOT.jar
|
||||||
|
dest: /tmp
|
||||||
|
- name: copy service file
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ./madhuri.service
|
||||||
|
dest: /etc/systemd/system/spring.service
|
||||||
|
- name: deamon-reload service
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
state: started
|
||||||
|
daemon_reload: true
|
||||||
|
enabled: true
|
||||||
|
name: spring.service
|
||||||
|
|
||||||
|
|
48
spc.yaml
48
spc.yaml
|
@ -1,48 +0,0 @@
|
||||||
---
|
|
||||||
- name: spc deployment
|
|
||||||
hosts: localhost
|
|
||||||
become: yes
|
|
||||||
tasks:
|
|
||||||
- name: install java
|
|
||||||
ansible.builtin.apt:
|
|
||||||
name: openjdk-17-jdk
|
|
||||||
state: present
|
|
||||||
update_cache: true
|
|
||||||
- name: make a directory
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: spc/
|
|
||||||
state: "directory"
|
|
||||||
mode: '777'
|
|
||||||
- name: get url
|
|
||||||
ansible.builtin.get_url:
|
|
||||||
dest: /tmp/
|
|
||||||
url: https://springpetclinic16feb.s3.ap-northeast-1.amazonaws.com/spring-petclinic-3.0.0-SNAPSHOT.jar
|
|
||||||
mode: '777'
|
|
||||||
- name: copy the content
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: /tmp/spring-petclinic-3.0.0-SNAPSHOT.jar
|
|
||||||
dest: spc/
|
|
||||||
mode: '777'
|
|
||||||
- name: edit the service file
|
|
||||||
ansible.builtin.copy:
|
|
||||||
dest: /etc/systemd/system/spc.service
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=Manage Java service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
WorkingDirectory=/home/ubuntu/spc
|
|
||||||
ExecStart=java -jar spring-petclinic-3.0.0-SNAPSHOT.jar
|
|
||||||
Type=simple
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=10
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
mode: '777'
|
|
||||||
- name: reload the systemd state
|
|
||||||
ansible.builtin.systemd:
|
|
||||||
name: spc.service
|
|
||||||
daemon_reload: true
|
|
||||||
enabled: true
|
|
||||||
state: "restarted"
|
|
32
spc1.yaml
32
spc1.yaml
|
@ -1,32 +0,0 @@
|
||||||
---
|
|
||||||
- name: spc deployment
|
|
||||||
hosts: localhost
|
|
||||||
become: yes
|
|
||||||
tasks:
|
|
||||||
- name: install java
|
|
||||||
ansible.builtin.apt:
|
|
||||||
name: openjdk-17-jdk
|
|
||||||
state: present
|
|
||||||
update_cache: true
|
|
||||||
- name: edit the service file
|
|
||||||
ansible.builtin.copy:
|
|
||||||
dest: /etc/systemd/system/spc.service
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=Manage Java service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
WorkingDirectory=/home/ubuntu/spc/target
|
|
||||||
ExecStart=java -jar spring-petclinic-3.0.0-SNAPSHOT.jar
|
|
||||||
Type=simple
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=10
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
mode: '777'
|
|
||||||
- name: reload the systemd state
|
|
||||||
ansible.builtin.systemd:
|
|
||||||
name: spc.service
|
|
||||||
daemon_reload: true
|
|
||||||
enabled: true
|
|
||||||
state: "restarted"
|
|
Loading…
Reference in a new issue