This Ansible playbook sets up a Minecraft server using Purpur for enhanced performance and plugin support. The server runs on an Ubuntu LTS/Debian 12 server and uses Oracle JDK 17 for Java. This playbook automates the installation process, making it easy to deploy and manage a Minecraft server.
- Ansible installed on your local machine.
- An Ubuntu server 22.04 (LTS recommended) or Debian 12 (Bookworm).
- Basic understanding of Ansible and server administration.
- SSH access to the server.
- Clone the repository:
git clone https://github.com/0xBingo/minecraft-playbook.git
cd minecraft-playbook
- Edit the Inventory:
Update the inventory
file with your server's IP address or hostname.
- Run the Bootstrap:
ansible-playbook bootstrap.yml --private-key=~/.ssh/id_rsa -i inventories/main/hosts
- Run the Playbook:
ansible-playbook site.yml --private-key=~/.ssh/id_rsa -i inventories/main/hosts
Configures UFW to allow Minecraft traffic.
Installs Oracle JDK 17 Java Development Kit.
Creates a dedicated minecraft
user to run the server.
Sets up the Minecraft server with Purpur, including necessary configuration and scripts.
Downloads and installs common Minecraft plugins.
- Starting the Server:
The server will be automatically started after the setup. To manually start the server:
sudo su minecraft
screen -S minecraft
cd /home/minecraft/purpur
./start.sh
- Stopping the Server:
Inside the screen
session, type stop
and press Enter
.
- Exiting the Screen Session:
Press Ctrl + A
then D
to detach from the screen session while leaving the server running.
- Backup the World:
The maintenance role includes a task to backup the world. You can run the maintenance playbook separately:
ansible-playbook site.yml --private-key=~/.ssh/id_rsa -i inventories/main/hosts
- System Updates:
Ensure your server and Java are up to date:
ansible-playbook maintenance.yml --private-key=~/.ssh/id_rsa -i inventories/main/hosts
Before running the cloudflare
role, make sure to follow the create-remote-tunnel documentation and add your tunnel token to the cloudflare_tunnel_token
inside the roles/cloudflare/defaults/main.yml
file.
If you setuped a cloudflare tunnel using the cloudflare
role :
- Make sure to execute the
scripts/minecraft.bat
script (for Windows users) or thescripts/minecraft.sh
script (for Linux users). - Add the minecraft server in your servers list with the server address
localhost:25565
. - You can connect.
/lp creategroup <name>
/lp group <name> permission set minecraft.command.gamemode false