homelab/roles/minecraft/tasks/modpacks.yml

36 lines
1.3 KiB
YAML
Raw Normal View History

- name: Download Minecraft modpack installer
2023-05-04 03:42:55 +00:00
ansible.builtin.get_url:
url: "{{ minecraft_modpack_url }}"
dest: "{{ minecraft_home }}/{{ item.name }}/serverinstall_{{ item.modpack | replace ('/', '_') }}"
owner: "{{ minecraft_user }}"
group: "{{ minecraft_user }}"
mode: 0700
loop: "{{ minecraft }}"
when: item.modpack is defined and item.sha1 is not defined
- name: Run Minecraft modpack installer
2023-05-04 03:42:55 +00:00
ansible.builtin.command: "sudo -u {{ minecraft_user }} ./serverinstall_{{ item.modpack | replace ('/', '_') }} --auto"
args:
creates: "{{ minecraft_home }}/{{ item.name }}/mods"
chdir: "{{ minecraft_home }}/{{ item.name }}"
loop: "{{ minecraft }}"
when: item.modpack is defined and item.sha1 is not defined
- name: Find Minecraft Forge
2023-05-04 03:42:55 +00:00
ansible.builtin.find:
paths: "{{ minecraft_home }}/{{ item.name }}"
patterns: "forge*.jar"
register: minecraft_forge
loop: "{{ minecraft }}"
when: item.modpack is defined and item.sha1 is not defined
- name: Link to Minecraft Forge
2023-05-04 03:42:55 +00:00
ansible.builtin.file:
src: "{{ item.files[0].path }}"
dest: "{{ minecraft_home }}/{{ item.item.name }}/minecraft_server.jar"
owner: "{{ minecraft_user }}"
group: "{{ minecraft_user }}"
state: link
loop: "{{ minecraft_forge.results }}"
when: minecraft_forge is defined and item.files[0].path is defined