From 850d0e97f8aaedf4320b34f84923fc87b1009a97 Mon Sep 17 00:00:00 2001 From: Salt Date: Wed, 24 Jun 2020 09:20:25 -0500 Subject: [PATCH] Work on improving Minecraft deployments --- roles/minecraft/tasks/main.yml | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/roles/minecraft/tasks/main.yml b/roles/minecraft/tasks/main.yml index 5836211..e306a79 100644 --- a/roles/minecraft/tasks/main.yml +++ b/roles/minecraft/tasks/main.yml @@ -46,21 +46,37 @@ stat: path: "/var/minecraft/{{ mcname }}/forge-{{ mcforge }}-universal.jar" register: stat_mcroot_forgejar + - name: Download zip + get_url: + dest: "/var/minecraft/{{ mcname }}/modpack.zip" + url: "{{ mczip }}" + register: get_mcpack - name: Unpack archive block: - - name: Download zip - get_url: - dest: "/var/minecraft/{{ mcname }}/modpack.zip" - url: "{{ mczip }}" - 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