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: stat:
path: "/var/minecraft/{{ mcname }}/forge-{{ mcforge }}-universal.jar" path: "/var/minecraft/{{ mcname }}/forge-{{ mcforge }}-universal.jar"
register: stat_mcroot_forgejar register: stat_mcroot_forgejar
- name: Download zip
get_url:
dest: "/var/minecraft/{{ mcname }}/modpack.zip"
url: "{{ mczip }}"
register: get_mcpack
- name: Unpack archive - name: Unpack archive
block: block:
- name: Download zip
get_url:
dest: "/var/minecraft/{{ mcname }}/modpack.zip"
url: "{{ mczip }}"
- name: Unpack zip - name: Unpack zip
unarchive: unarchive:
src: "/var/minecraft/{{ mcname }}/modpack.zip" src: "/var/minecraft/{{ mcname }}/modpack.zip"
remote_src: yes remote_src: yes
dest: "/var/minecraft/{{ mcname }}" 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: file:
path: "/var/minecraft/{{ mcname }}/modpack.zip" path: "{{ item }}"
state: absent state: absent
loop:
- "/var/minecraft/{{ mcname }}/.minecraft"
- "/var/minecraft/{{ mcname }}/instance.cfg"
- "/var/minecraft/{{ mcname }}/mmc-pack.json"
- name: Download Forge - name: Download Forge
get_url: get_url:
dest: "/var/minecraft/{{ mcname }}/installer.jar" dest: "/var/minecraft/{{ mcname }}/installer.jar"
@ -82,7 +98,7 @@
path: "/var/minecraft/{{ mcname }}/server.jar" path: "/var/minecraft/{{ mcname }}/server.jar"
src: "/var/minecraft/{{ mcname }}/forge-{{ mcforge }}-universal.jar" src: "/var/minecraft/{{ mcname }}/forge-{{ mcforge }}-universal.jar"
state: link state: link
when: not stat_mcroot_forgejar.stat.exists when: not stat_mcroot_forgejar.stat.exists or get_mcpack is changed
- name: Configure server - name: Configure server
block: block:
- name: Template out server.properties - name: Template out server.properties