homelab/roles/minecraft/tasks/main.yml

29 lines
742 B
YAML
Raw Normal View History

2024-11-19 14:49:05 +05:00
- 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