remove minecraft multi-instance support

This commit is contained in:
Ryan Cavicchioni 2020-08-22 10:00:13 -05:00
parent 302b6525f6
commit cfe9012e32
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
4 changed files with 12 additions and 43 deletions

View File

@ -15,8 +15,7 @@ minecraft_jar_url: https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd18921
minecraft_jar_checksum: sha256:80cf86dc2004ec6a2dc0183d1c75a9af3ba0669f7c332e4247afb1d76fb67e8a
minecraft_opt_path: /opt/minecraft
minecraft_var_path: "{{ minecraft_opt_path }}/var"
minecraft_backup_path: "{{ minecraft_opt_path }}/backup"
minecraft_var_path: /var/opt/minecraft
minecraft_syslog_facility: local5

View File

@ -14,9 +14,3 @@
service:
name: rsyslog
state: restarted
- name: restart minecraft instances
service:
name: "minecraft@{{ item.name }}.service"
state: restarted
loop: "{{ minecraft_worlds | default([]) }}"

View File

@ -37,12 +37,11 @@
- name: create minecraft var directory
file:
path: "{{ minecraft_var_path }}/{{ item.name }}"
path: "{{ minecraft_var_path }}"
state: directory
owner: "{{ minecraft_user }}"
group: "{{ minecraft_group }}"
mode: "0755"
loop: "{{ minecraft_worlds }}"
- name: download minecraft server
get_url:
@ -52,31 +51,29 @@
group: "{{ minecraft_group }}"
mode: "0644"
checksum: "{{ minecraft_jar_checksum }}"
notify: restart minecraft instances
notify: restart minecraft
- name: agree to the eula
copy:
content: "eula=true"
dest: "{{ minecraft_var_path }}/{{ item.name }}/eula.txt"
dest: "{{ minecraft_var_path }}/eula.txt"
owner: "{{ minecraft_user }}"
group: "{{ minecraft_group }}"
mode: "0644"
loop: "{{ minecraft_worlds }}"
- name: configure minecraft
template:
src: server.properties.j2
dest: "{{ minecraft_var_path }}/{{ item.name }}/server.properties"
dest: "{{ minecraft_var_path }}/server.properties"
owner: root
group: root
mode: 0644
notify: restart minecraft instances
loop: "{{ minecraft_worlds }}"
notify: restart minecraft
- name: configure systemd unit
template:
src: minecraft.service.j2
dest: /etc/systemd/system/minecraft@.service
dest: /etc/systemd/system/minecraft.service
owner: root
group: root
mode: 0644
@ -85,30 +82,9 @@
- name: manage minecraft service
service:
name: "minecraft@{{ item.name }}"
state: "{{ item.state | default(minecraft_service_state) }}"
enabled: "{{ item.enabled | default(minecraft_service_enabled) }}"
loop: "{{ minecraft_worlds }}"
#- name: configure ops
# copy:
# content: "{{ (minecraft_ops | default([])) | to_nice_json }}"
# dest: "{{ minecraft_var_path }}/ops.json"
# owner: "{{ minecraft_user }}"
# group: "{{ minecraft_group }}"
# mode: "0644"
# force: no
# notify: restart minecraft instances
#
#- name: configure whitelist
# copy:
# content: "{{ (minecraft_whitelist | default([])) | to_nice_json }}"
# dest: "{{ minecraft_var_path }}/whitelist.json"
# owner: "{{ minecraft_user }}"
# group: "{{ minecraft_group }}"
# mode: "0644"
# force: no
# notify: restart minecraft instances
name: minecraft.service
state: "{{ minecraft_service_state }}"
enabled: "{{ minecraft_service_enabled }}"
- name: install discord notifier
copy:

View File

@ -1,7 +1,7 @@
# {{ ansible_managed }}
[Unit]
Description=Minecraft server %i
Description=Minecraft server
After=network.target
[Service]
@ -10,7 +10,7 @@ SuccessExitStatus=143
Type=simple
User={{ minecraft_user }}
Group={{ minecraft_group }}
WorkingDirectory={{ minecraft_var_path }}/%i
WorkingDirectory={{ minecraft_var_path }}
Restart=on-failure
SyslogIdentifier=minecraft
SyslogFacility={{ minecraft_syslog_facility }}