homelab/roles/minecraft/tasks/main.yml

32 lines
889 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"
2024-11-22 01:39:59 +05:00
user: "{{ user }}"
2024-11-19 14:49:05 +05:00
env:
EULA: "{{ eula | string }}"
2024-11-22 01:39:59 +05:00
MOTD: "{{ motd }}"
2024-11-19 14:49:05 +05:00
TYPE: "{{ server_type }}"
VERSION: "{{ server_version }}"
DIFFICULTY: "{{ difficulty }}"
ONLINE_MODE: "{{ online_mode | string }}"
SERVER_NAME: "{{ server_name }}"
2024-11-22 01:39:59 +05:00
MAX_PLAYERS: "{{ max_players | string }}"
USE_SIMD_FLAGS: "{{ use_simd_flags | string }}"
2024-11-19 14:49:05 +05:00
volumes:
- minecraft:/data
2024-11-22 01:39:59 +05:00
- /etc/timezone:/etc/timezone:ro
2024-11-19 14:49:05 +05:00
healthcheck:
test: ["CMD", "mc-health"]
interval: 30s
start_period: 2m
retries: 2
restart_policy: unless-stopped