### Description This PR adds new `minecraft_server` to configure and start a Minecraft server container on targeted hosts. ### Related Issue Closes #18 ### Testing Done - [x] Verifed new role creates container files correctly - [x] verified new container is able to start and run via systemd - [x] verified server is accessible via Minecraft client ### Checklist - [x] My code follows the project's style guidelines. - [x] I have performed a self-review of my own code. - [x] I have updated the documentation (if necessary). --------- Co-authored-by: Jordan Del Pilar <[email protected]> Reviewed-on: #19
2.2 KiB
Role: Minecraft Server
Sets up and deploys minecraft server container
Tags
- minecraft
Required Variables
Below is an annotated breakdown of the required variables and their structure for this role
These blocks should be defined in the host_vars file for any host that should be a minecraft server
Warning
Any variable marked
# !SENSITIVEshould not be stored in plain text under any circumstance
Minecraft Info
Defines settings for the Minecraft server container settings
# (required) List of all minecraft server containers to be deployed
# you can run as many minecraft servers as the hardware can handle. However, all will need a unique port
# at least one service is required
minecraft_servers:
# (required) name of the server container
# all containers and services will be prefixed with 'mc-'
# for example if you list 'vanilla' as the name the resulting container/service name will be 'mc-vanilla'
# format: snake_case
- name:
# (required) URL of container image
# can be from any container registry
# recommended image is: docker.io/itzg/minecraft-server:latest
# format: url
image: docker.io/itzg/minecraft-server:latest
# (optional) host port to bind to the container
# this must be unique for each server instance
# default: 25565
# format: int
port:
# (optional) list of environment variables to pass to the container
# these are primarily used to define settings for the minecraft server
# for more info please read the docs for your specific container image
# memory setting example listed to show proper format
# format: key value pair
env:
MEMORY: 4G
Templates
minecraft.container.j2
This template is used to generate .container files for Minecraft servers. This template is heavily opinionated to be a minecraft server instance and should not be used a generic template for quadlets.
Execution
Note
If this role makes changes to the quadlet file on the host the server will be restarted. If you are hosting this server for multiple users please keep that in mind
To run this command without running all roles in the playbook, use the following command
ansible-playbook site.yaml --tags "minecraft"