mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-29 18:55:49 +00:00
Create ansibleplaybook.yaml
This commit is contained in:
parent
841a8c74d2
commit
cf4abcab59
1 changed files with 42 additions and 0 deletions
42
ansibleplaybook.yaml
Normal file
42
ansibleplaybook.yaml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: spc deployment
|
||||||
|
hosts: localhost
|
||||||
|
become: yes
|
||||||
|
tasks:
|
||||||
|
- name: install java
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: openjdk-17-jdk
|
||||||
|
state: present
|
||||||
|
update_cache: true
|
||||||
|
- name: get url
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
dest: /tmp
|
||||||
|
url: https://dev.azure.com/bujji1011bujji0481/_apis/resources/Containers/3419250/drop?itemPath=drop%2Ftarget%2Fspring-petclinic-3.0.0-SNAPSHOT.jar
|
||||||
|
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
|
||||||
|
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: Start service httpd, if not running
|
||||||
|
service:
|
||||||
|
enabled: true
|
||||||
|
name: spc.service
|
||||||
|
state: "started"
|
||||||
|
- name: daemon reload
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: spc.service
|
||||||
|
daemon_reload: true
|
||||||
|
enabled: true
|
||||||
|
state: "restarted"
|
Loading…
Reference in a new issue