Add function to remove mods from a server

Fun thing we gain from this for free: the ability to scriptedly remove client-side mods from 1.7.10 and earlier packs
This commit is contained in:
Salt 2020-11-21 06:54:38 -06:00
parent 06adfd1694
commit a162c43cce
2 changed files with 9 additions and 1 deletions

View File

@ -20,6 +20,9 @@ minecraft_forge_downloadurl: "https://files.minecraftforge.net/maven/net/minecra
#minecraft_forge_packurl: https://path.to.your/modpack.zip #minecraft_forge_packurl: https://path.to.your/modpack.zip
# Define THIS if you want to download a bunch of mods by JAR URL: # Define THIS if you want to download a bunch of mods by JAR URL:
minecraft_forge_mods: [] minecraft_forge_mods: []
# Define THIS if you want to remove any mods that come with a pack by default
# Just a list of filenames in /mods. Matches directories, too
minecraft_forge_mods_remove: []
minecraft_vanilla_install: no minecraft_vanilla_install: no
minecraft_vanilla_downloadurl: "https://launcher.mojang.com/v1/objects/35139deedbd5182953cf1caa23835da59ca3d7cd/server.jar" minecraft_vanilla_downloadurl: "https://launcher.mojang.com/v1/objects/35139deedbd5182953cf1caa23835da59ca3d7cd/server.jar"

View File

@ -75,8 +75,13 @@
- name: install mods - name: install mods
get_url: dest="{{ minecraft_home }}/{{ minecraft_name }}/mods" url={{ item }} get_url: dest="{{ minecraft_home }}/{{ minecraft_name }}/mods" url={{ item }}
loop: "{{ minecraft_forge_mods }}" loop: "{{ minecraft_forge_mods }}"
notify: restart minecraft {{ minecraft_name }} notify: "restart minecraft {{ minecraft_name }}"
when: minecraft_forge_mods is iterable and minecraft_forge_mods != None when: minecraft_forge_mods is iterable and minecraft_forge_mods != None
- name: remove mods
file: path={{ minecraft_home }}/{{ minecraft_name }}/mods/{{ item }} state=absent
loop: "{{ minecraft_forge_mods_remove }}"
notify: "restart minecraft {{ minecraft_name }}"
when: minecraft_forge_mods_remove is iterable and minecraft_forge_mods_remove != None
become: yes become: yes
become_user: minecraft become_user: minecraft
when: minecraft_forge_install and minecraft_forge_version is defined when: minecraft_forge_install and minecraft_forge_version is defined