Start minecraft server
This commit is contained in:
parent
9194fe3a05
commit
a73cebb48f
4 changed files with 57 additions and 0 deletions
5
minecraft.yml
Normal file
5
minecraft.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- hosts: webservers
|
||||||
|
roles:
|
||||||
|
- name: minecraft
|
||||||
|
server_name: Comfy Camp
|
17
roles/minecraft/meta/argument_specs.yml
Normal file
17
roles/minecraft/meta/argument_specs.yml
Normal 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
|
28
roles/minecraft/tasks/main.yml
Normal file
28
roles/minecraft/tasks/main.yml
Normal 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
|
7
roles/minecraft/vars/main.yml
Normal file
7
roles/minecraft/vars/main.yml
Normal 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
|
Loading…
Reference in a new issue