Start minecraft server

This commit is contained in:
Ivan R. 2024-11-19 14:49:05 +05:00
parent 9194fe3a05
commit a73cebb48f
Signed by: lumin
GPG key ID: E0937DC7CD6D3817
4 changed files with 57 additions and 0 deletions

5
minecraft.yml Normal file
View file

@ -0,0 +1,5 @@
---
- hosts: webservers
roles:
- name: minecraft
server_name: Comfy Camp

View file

@ -0,0 +1,17 @@
argument_specs:
main:
options:
eula:
type: bool
server_type:
type: str
server_version:
type: str
online_mode:
type: bool
server_name:
type: str
difficulty:
type: str
tz:
type: str

View file

@ -0,0 +1,28 @@
- name: Create minecraft volume
become: true
community.docker.docker_volume:
name: minecraft
- name: Create minecraft container
become: true
community.docker.docker_container:
name: minecraft
image: itzg/minecraft-server:stable
ports:
- "25565:25565"
user: "1003:972"
env:
EULA: "{{ eula | string }}"
TYPE: "{{ server_type }}"
VERSION: "{{ server_version }}"
DIFFICULTY: "{{ difficulty }}"
ONLINE_MODE: "{{ online_mode | string }}"
SERVER_NAME: "{{ server_name }}"
TZ: "{{ tz }}"
volumes:
- minecraft:/data
healthcheck:
test: ["CMD", "mc-health"]
interval: 30s
start_period: 2m
retries: 2
restart_policy: unless-stopped

View file

@ -0,0 +1,7 @@
eula: true
server_type: PAPER
server_version: "1.21"
online_mode: false
server_name: Minecraft Server
difficulty: hard
tz: Asia/Yekaterinburg