1
0
Fork 0

add restart handler

This commit is contained in:
Massaki Archambault 2023-06-13 19:11:16 -04:00
parent ef5406bfac
commit 354f399b11
3 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,3 @@
mc_server_version: 15c777e2cfe0556eef19aab534b186c0c6f277e1
mc_server_memory: 1G
mc_server_memory: 1000M
mc_server_ops: []

View File

@ -0,0 +1,5 @@
- name: Restart server
systemd:
name: minecraft-server
daemon_reload: yes
state: restarted

View File

@ -24,6 +24,7 @@
get_url:
url: https://piston-data.mojang.com/v1/objects/{{ mc_server_version }}/server.jar
dest: /srv/minecraft-server
notify: Restart server
- name: Accept EULA
copy:
@ -34,21 +35,23 @@
copy:
content: "{{ mc_server_ops }}"
dest: /srv/minecraft-server/ops.json
notify: Restart server
- name: Install server script
template:
src: minecraft-server.sh
dest: /srv/minecraft-server/minecraft-server.sh
notify: Restart server
- name: Install minecraft-server systemd unit
copy:
src: minecraft-server.service
dest: /etc/systemd/system/minecraft-server.service
mode: 0644
notify: Restart server
- name: Enable minecraft-server service
systemd:
name: minecraft-server
daemon_reload: yes
state: started
enabled: yes