1
0
Fork 0

refer to main minecraft-server repo

This commit is contained in:
Massaki Archambault 2023-11-18 02:57:18 -05:00
parent 77a556dc21
commit fe3c000096
11 changed files with 122 additions and 2 deletions

1
hosts
View File

@ -34,6 +34,7 @@ all:
hosts: hosts:
minecraft-server: minecraft-server:
ansible_host: 192.168.20.32 ansible_host: 192.168.20.32
mc_server_jar: https://piston-data.mojang.com/v1/objects/5b868151bd02b41319f54c8d4061b8cae84e665c/server.jar
mc_server_memory: 3500M mc_server_memory: 3500M
mc_server_ops: mc_server_ops:
- uuid: 649a9370-5cad-4553-93c8-cf0af25208dd - uuid: 649a9370-5cad-4553-93c8-cf0af25208dd

View File

@ -1,3 +1,3 @@
mc_server_version: 15c777e2cfe0556eef19aab534b186c0c6f277e1 mc_server_jar: https://piston-data.mojang.com/v1/objects/5b868151bd02b41319f54c8d4061b8cae84e665c/server.jar
mc_server_memory: 1000M mc_server_memory: 1000M
mc_server_ops: [] mc_server_ops: []

View File

@ -0,0 +1,2 @@
install_date: Sat 18 Nov 2023 07:52:40 AM
version: ''

View File

View File

@ -0,0 +1,38 @@
# ---> VisualStudioCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
# ---> Vim
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
# ---> Ansible
*.retry

View File

@ -0,0 +1,57 @@
# ansible-minecraft-server
An ansible role to deploy a minecraft server.
Playbook was tested on a Ubuntu 22.04 LXC container hosted in Proxmox 7.4.
## Prerequisites
* Some basic Linux knowledge.
* A machine to host the minecraft server.
* Exact steps will vary depending on your hosting solution. Refer to their documentation.
* Refer to the [wiki](https://minecraft.fandom.com/wiki/Server/Requirements) for recommendations on the appropriate size of the machine for your expected player count.
* Make sure to create a user account on the server with access to the command `sudo` (sudoer). Make this account have the same name as your local user account to simplify deployment.
* [ansible](https://docs.ansible.com/ansible/latest/index.html)
## Deploy
1. Edit *hosts* and replace `minecraft-server` with the hostname or ip of the machine hosting the minecraft server.
2. Edit *group_vars/minecraft-server.yaml* to change the basic server configuration. Refer to **Configuration options** below for more detail on available configurations.
* Set `mc_server_memory` to an appropriate value.
* Optionally, configure `mc_server_ops` to be the info of a server "operator" (admin).
3. Deploy the minecraft server using the command: `ansible-playbook --ask-become-pass -i hosts site.yaml`
* You will be prompted for a password by ansible. Provide the password that you would use to run a command with `sudo` on the server.
## Configuration options
All configuration options are in the file `group_var/minecraft-server.yaml`. Additional configurations are available, but are not exposed by the ansible role at this time. To change them, you can connect to the server and find them in the server install directory */srv/minecraft-server*.
Do not edit the following configuration files, they will be overwritten if ansible is ran again:
* */srv/minecraft-server/eula.txt*
* */srv/minecraft-server/ops.json*
This table list the options that can be configured in `group_var/minecraft-server.yaml`
| Name | Default | Description |
| --- | --- | --- |
| `mc_server_version` | `15c777e2cfe0556eef19aab534b186c0c6f277e1` | The version of the server to download on the server |
| `mc_server_memory` | `1000M` (1GB) | The quantity of the memory assigned to the minecraft server. Take care of leaving some (around 500M) memory available for system processes. Memory requirements scales with the number of players on the server, refer to the [wiki](https://minecraft.fandom.com/wiki/Server/Requirements) for recommendations.
| `mc_server_ops` | `[]` (none) | A list of server operators (admins). See the section below on what needs to be provided for each entry to the list |
Each entries of the list `mc_server_ops` must have the **all** following values set:
| Name | Example | Description |
| --- | --- | --- |
| `uuid` | `649a9370-5cad-4553-93c8-cf0af25208dd` | The uuid of the the player. The uuid can be queried using [this tool](https://mcuuid.net/). |
| `name` | `jirost` | The name of the player. |
| `level` | `4` | The level of permissions granted to the player. Refer to the [wiki](https://minecraft.fandom.com/wiki/Permission_level) for more details |
### Example configuration
``` yaml
# Assign 3.5GB of memory to the server
mc_server_memory: 3500M
# Grant player with name "jirost" owner permissions
mc_server_ops:
- uuid: 649a9370-5cad-4553-93c8-cf0af25208dd
name: jirost
level: 4
```

View File

@ -0,0 +1,5 @@
# mc_server_memory: 3500M
# mc_server_ops:
# - uuid: 649a9370-5cad-4553-93c8-cf0af25208dd
# name: jirost
# level: 4

View File

@ -0,0 +1,2 @@
[minecraft-server]
minecraft-server ansible_become=true ansible_become_method=sudo ansible_become_user=root

View File

@ -0,0 +1,10 @@
- hosts: all
tasks:
- name: Perform system update
apt:
update_cache: true
upgrade: true
- hosts: all
roles:
- minecraft-server

View File

@ -22,7 +22,7 @@
- name: Download server jar - name: Download server jar
get_url: get_url:
url: https://piston-data.mojang.com/v1/objects/{{ mc_server_version }}/server.jar url: "{{ mc_server_jar }}"
dest: /srv/minecraft-server dest: /srv/minecraft-server
notify: Restart server notify: Restart server

5
roles/requirements.yml Normal file
View File

@ -0,0 +1,5 @@
# ansible-galaxy install --role-file roles/requirements.yml --roles-path roles/
- src: https://code.badjware.dev/badjware/ansible-minecraft-server.git
name: minecraft-server
scm: git