devops-coop / ansible-minecraft

Ansible role for provisioning a vanilla Minecraft server
https://galaxy.ansible.com/devops-coop/minecraft/
Apache License 2.0
57 stars 38 forks source link

Load archived world files from a URL #6

Closed markrcote closed 8 years ago

markrcote commented 8 years ago

It would be nice if ansible-minecraft could load world files from an archive, either local or remote. This would only happen if there was no world present (generally, a new installation). We could autodetect standard archive types (zip, tarball).

I'm planning on working on this if you think it makes sense (comments welcome on general requirements/design).

benwebber commented 8 years ago

This is a cool idea. As an intermediate step, what about a sort of hook/stage system?

We might write:

- hosts: all
  roles:
    role: benwebber.minecraft
    minecraft_before_server_start: "{{ playbook_dir }}/download-world.yml"

Ansistrano uses this technique to great effect.

benwebber commented 8 years ago

I have released 3.0.0 with support for server.properties and hooks. Will the before start hook work for your use case?

markrcote commented 8 years ago

Yeah, that would work. Looks pretty straightforward.

benwebber commented 8 years ago

Great! Let me know if you run into any issues.

I'm not opposed to rolling this feature into the role, but it would need to be sufficiently generic enough to help most users.

Down the line, we could ship includes with the role itself. Users could use them like so:

- hosts: all
  roles:
    role: benwebber.minecraft
    minecraft_hook_before_start: "{{ role_path }}/tasks/hooks/before-start/download-world.yml"
markrcote commented 8 years ago

Do you see this hook being called at the end of tasks/main.yml? The other logical place would be handlers/main.yml, but that's only called if restart Minecraft is triggered (but maybe that's okay?).

markrcote commented 8 years ago

Or, actually, I guess it would have to go before generate server.properties, since (for example) that would create world and any other missing files, and hence would make my particular use case more difficult (since I'd only want to load the world files if they don't already exist).

benwebber commented 8 years ago

You could use minecraft_hook_after_install instead. That runs after symlinking the server, but before configuring and starting it.