From e9113856ea589c4a7fc66aaecd03fbea89f9ae19 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sat, 10 Oct 2020 10:59:45 -0500 Subject: [PATCH] Build minecraft server.properties from Ansible variable --- roles/minecraft/defaults/main.yaml | 5 +++++ roles/minecraft/templates/server.properties.j2 | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/roles/minecraft/defaults/main.yaml b/roles/minecraft/defaults/main.yaml index c93c084..a609ef9 100644 --- a/roles/minecraft/defaults/main.yaml +++ b/roles/minecraft/defaults/main.yaml @@ -20,3 +20,8 @@ minecraft_var_path: /var/opt/minecraft minecraft_syslog_facility: local5 minecraft_notifier_state: present + +minecraft_config: + white-list: true + enforce-whitelist: true + server-port: 25565 diff --git a/roles/minecraft/templates/server.properties.j2 b/roles/minecraft/templates/server.properties.j2 index d2e93e1..68821bc 100644 --- a/roles/minecraft/templates/server.properties.j2 +++ b/roles/minecraft/templates/server.properties.j2 @@ -1,3 +1,5 @@ -white-list: {{ (minecraft_config.whitelist | default(true)) | ternary('true', 'false') }} -enforce-whitelist: {{ (minecaft_config.enfoce_whitelist | default(true)) | ternary('true', 'false') }} -server-port: {{ item.port | default(25565) }} +# {{ ansible_managed }} + +{% for k, v in minecraft_config.items() | default({}) %} +{{ k }}: {{ v }} +{% endfor %}