63 lines
2.4 KiB
YAML
63 lines
2.4 KiB
YAML
---
|
|
# =============================================================================
|
|
# Minecraft Podman Deployment - Main Playbook
|
|
# =============================================================================
|
|
# Usage:
|
|
# ansible-playbook site.yml # Deploy to all minecraft servers
|
|
# ansible-playbook site.yml --limit external-apps # Deploy to specific host
|
|
# ansible-playbook site.yml --tags install # Only run install tasks
|
|
# ansible-playbook site.yml --tags config # Only run config tasks
|
|
# ansible-playbook site.yml --tags backup # Only run backup tasks
|
|
# ansible-playbook site.yml --tags update # Only run update tasks
|
|
|
|
- name: Deploy Minecraft Server on Podman
|
|
hosts: minecraft
|
|
become: true
|
|
gather_facts: true
|
|
|
|
pre_tasks:
|
|
- name: Display deployment info
|
|
ansible.builtin.debug:
|
|
msg: |
|
|
========================================
|
|
Minecraft Podman Deployment
|
|
========================================
|
|
Target: {{ inventory_hostname }}
|
|
Server: {{ minecraft.server_name }}
|
|
Type: {{ minecraft.server_type }}
|
|
Image: {{ podman.image }}
|
|
Port: {{ minecraft.port }}
|
|
Memory: {{ minecraft.java_memory }}
|
|
========================================
|
|
|
|
- name: Verify target is Fedora
|
|
ansible.builtin.assert:
|
|
that:
|
|
- ansible_distribution == "Fedora"
|
|
fail_msg: "This playbook is designed for Fedora. Detected: {{ ansible_distribution }}"
|
|
success_msg: "Fedora {{ ansible_distribution_version }} confirmed"
|
|
|
|
roles:
|
|
- role: minecraft-podman
|
|
tags:
|
|
- install
|
|
- config
|
|
- backup
|
|
- update
|
|
- always
|
|
|
|
post_tasks:
|
|
- name: Display completion message
|
|
ansible.builtin.debug:
|
|
msg: |
|
|
========================================
|
|
Deployment Complete!
|
|
========================================
|
|
Server IP: {{ ansible_default_ipv4.address | default(ansible_host) }}
|
|
Port: {{ minecraft.port }}
|
|
RCON: {{ 'Enabled' if minecraft.rcon_enabled else 'Disabled' }}
|
|
Status: {{ minecraft.server_name }}.service
|
|
========================================
|
|
Connect: {{ ansible_default_ipv4.address | default(ansible_host) }}:{{ minecraft.port }}
|
|
========================================
|