From 00f5684408ca1232e233194a2bea3d42579d5ab0 Mon Sep 17 00:00:00 2001 From: Eric Meehan Date: Fri, 12 Sep 2025 13:32:03 -0400 Subject: [PATCH] Closes Gaming/ansible-role-vintage-story#1 --- tasks/main.yml | 21 +++++++++++++++++++++ templates/serverconfig.json.j2 | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index d38a664..3a9219b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -26,6 +26,18 @@ requests: storage: 32Gi +- name: Create a ConfigMap + k8s: + state: present + definition: + apiVersion: v1 + kind: ConfigMap + metadata: + name: config + namespace: vintage-story + data: + serverconfig.json: "{{ lookup('template', 'serverconfig.json.j2') }}" + - name: Create Deployment for Vintage Story k8s: definition: @@ -50,6 +62,9 @@ volumeMounts: - name: data mountPath: /gamedata + - name: config + mountPath: /gamedata/vs/serverconfig.json + subPath: serverconfig.json imagePullPolicy: IfNotPresent ports: - containerPort: 42420 @@ -57,6 +72,12 @@ - name: data persistentVolumeClaim: claimName: data + - name: config + configMap: + name: config + items: + - key: serverconfig.json + path: serverconfig.json - name: Create Service for Vintage Story k8s: diff --git a/templates/serverconfig.json.j2 b/templates/serverconfig.json.j2 index 4655f80..e035e3e 100644 --- a/templates/serverconfig.json.j2 +++ b/templates/serverconfig.json.j2 @@ -1,7 +1,7 @@ { "FileEditWarning": "", "ConfigVersion": "1.8", - "ServerName": "Vintage Story Server on eom.dev", + "ServerName": "{{ ServerName }}", "ServerUrl": null, "ServerDescription": null, "WelcomeMessage": "Welcome {0}, may you survive well and prosper", @@ -355,7 +355,7 @@ "AllowFallingBlocks": true, "HostedMode": false, "HostedModeAllowMods": false, - "StartupCommands": "/whitelist add 3wm/diYjPGuydHNvOd6H0fDy", + "StartupCommands": "{{ StartupCommands }}", "RepairMode": false, "AnalyzeMode": false, "CorruptionProtection": true,