From 4bee97a542114f1dc5844d1f913b3631e05e6fcd Mon Sep 17 00:00:00 2001 From: Ivan Reshetnikov Date: Fri, 22 Nov 2024 01:39:59 +0500 Subject: [PATCH] Add more options for minecraft role --- minecraft.yml | 3 ++ roles/minecraft/meta/argument_specs.yml | 37 +++++++++++++++++++++++-- roles/minecraft/tasks/main.yml | 7 +++-- roles/minecraft/vars/main.yml | 7 +++-- 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/minecraft.yml b/minecraft.yml index 72e2e8e..58c92dc 100644 --- a/minecraft.yml +++ b/minecraft.yml @@ -2,4 +2,7 @@ - hosts: webservers roles: - name: minecraft + eula: true + user: 1003:972 server_name: Comfy Camp + use_simd_flags: true diff --git a/roles/minecraft/meta/argument_specs.yml b/roles/minecraft/meta/argument_specs.yml index dc2369f..9896910 100644 --- a/roles/minecraft/meta/argument_specs.yml +++ b/roles/minecraft/meta/argument_specs.yml @@ -1,10 +1,36 @@ argument_specs: main: options: + user: + type: str eula: type: bool + motd: + type: str server_type: type: str + choices: + - VANILLA + - BUKKIT + - SPIGOT + - CANYON + - FABRIC + - FORGE + - NEOFORGE + - MAGMA + - MAGMA_MAINTAINED + - KETTING + - MOHIST + - CATSERVER + - SPONGEVANILLA + - LIMBO + - CRUCIBLE + - CUSTOM + - PAPER + - PUFFERFISH + - PURPUR + - FOLIA + - QUILT server_version: type: str online_mode: @@ -13,5 +39,12 @@ argument_specs: type: str difficulty: type: str - tz: - type: str + choices: + - peaceful + - easy + - normal + - hard + max_players: + type: int + use_simd_flags: + type: bool diff --git a/roles/minecraft/tasks/main.yml b/roles/minecraft/tasks/main.yml index 0dbf64b..e67f946 100644 --- a/roles/minecraft/tasks/main.yml +++ b/roles/minecraft/tasks/main.yml @@ -9,17 +9,20 @@ image: itzg/minecraft-server:stable ports: - "25565:25565" - user: "1003:972" + user: "{{ user }}" env: EULA: "{{ eula | string }}" + MOTD: "{{ motd }}" TYPE: "{{ server_type }}" VERSION: "{{ server_version }}" DIFFICULTY: "{{ difficulty }}" ONLINE_MODE: "{{ online_mode | string }}" SERVER_NAME: "{{ server_name }}" - TZ: "{{ tz }}" + MAX_PLAYERS: "{{ max_players | string }}" + USE_SIMD_FLAGS: "{{ use_simd_flags | string }}" volumes: - minecraft:/data + - /etc/timezone:/etc/timezone:ro healthcheck: test: ["CMD", "mc-health"] interval: 30s diff --git a/roles/minecraft/vars/main.yml b/roles/minecraft/vars/main.yml index 412df2a..ad86c6f 100644 --- a/roles/minecraft/vars/main.yml +++ b/roles/minecraft/vars/main.yml @@ -1,7 +1,10 @@ -eula: true +motd: A minecraft server +user: "1000:1000" +eula: false server_type: PAPER server_version: "1.21" online_mode: false server_name: Minecraft Server difficulty: hard -tz: Asia/Yekaterinburg +max_players: 20 +use_simd_flags: false