Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Minecraft installation on Kubernetes via Ansible and Helm
# Minecraft Server deployment for Kubernetes clusters via Ansible's Helm module.
# The Helm module is part of the Kubernetes collection. Install it with:
# ansible-galaxy collection install community.kubernetes
# Then run the playbook:
# ansible-playbook main.yml
# This playbook assumes the following:
# 1. Your default ~/.kube/config points to a running Kubernetes cluster;
# otherwise set the K8S_AUTH_KUBECONFIG environment variable to the path to
# the correct kubeconfig).
# 2. You already have Helm and Ansible installed locally.
- hosts: localhost
connection: local
gather_facts: false
- name: Create minecraft namespace.
name: minecraft
api_version: v1
kind: Namespace
state: present
- name: Add itzg chart repo.
name: itzg
repo_url: ""
- name: Deploy Minecraft Helm chart.
name: minecraft
chart_ref: itzg/minecraft
chart_version: '2.0.7'
release_namespace: minecraft
state: present
eula: true
Difficulty: easy
motd: "Welcome to Minecraft deployed via Helm and Ansible!"
serviceType: NodePort
- name: Get Minecraft server NodePort.
api_version: v1
name: minecraft-minecraft
kind: Service
namespace: minecraft
register: service
- name: Print Minecraft server NodePort.
msg: "Minecraft NodePort: {{ service.resources[0].spec.ports[0].nodePort }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment