Closed markrcote closed 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.
I have released 3.0.0 with support for server.properties
and hooks. Will the before start hook work for your use case?
Yeah, that would work. Looks pretty straightforward.
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"
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?).
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).
You could use minecraft_hook_after_install
instead. That runs after symlinking the server, but before configuring and starting it.
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).