Create spc1.yaml

This commit is contained in:
Kiranteja623 2023-02-24 13:48:06 +05:30 committed by GitHub
parent bf6cf2bf60
commit b1c47b86be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

32
spc1.yaml Normal file
View file

@ -0,0 +1,32 @@
---
- 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"