Work on improving Minecraft deployments

This commit is contained in:
Salt 2020-06-24 09:20:25 -05:00
parent a0b12509da
commit 850d0e97f8

View File

@ -46,21 +46,37 @@
stat:
path: "/var/minecraft/{{ mcname }}/forge-{{ mcforge }}-universal.jar"
register: stat_mcroot_forgejar
- name: Unpack archive
block:
- name: Download zip
get_url:
dest: "/var/minecraft/{{ mcname }}/modpack.zip"
url: "{{ mczip }}"
register: get_mcpack
- name: Unpack archive
block:
- name: Unpack zip
unarchive:
src: "/var/minecraft/{{ mcname }}/modpack.zip"
remote_src: yes
dest: "/var/minecraft/{{ mcname }}"
- name: Remove zip
- name: Detect MultiMC pack
stat:
path: "/var/minecraft/{{ mcname }}/.minecraft"
register: stat_mcroot_multimc
- name: Move .minecraft contents to root
command:
chdir: "/var/minecraft/{{ mcname }}"
argv:
- mv
- "/var/minecraft/{{ mcname }}/.minecraft/*"
- "."
- name: Remove MultiMC artifacts
file:
path: "/var/minecraft/{{ mcname }}/modpack.zip"
path: "{{ item }}"
state: absent
loop:
- "/var/minecraft/{{ mcname }}/.minecraft"
- "/var/minecraft/{{ mcname }}/instance.cfg"
- "/var/minecraft/{{ mcname }}/mmc-pack.json"
- name: Download Forge
get_url:
dest: "/var/minecraft/{{ mcname }}/installer.jar"
@ -82,7 +98,7 @@
path: "/var/minecraft/{{ mcname }}/server.jar"
src: "/var/minecraft/{{ mcname }}/forge-{{ mcforge }}-universal.jar"
state: link
when: not stat_mcroot_forgejar.stat.exists
when: not stat_mcroot_forgejar.stat.exists or get_mcpack is changed
- name: Configure server
block:
- name: Template out server.properties