aboutsummaryrefslogtreecommitdiffstats
path: root/roles/ksplmp
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2021-01-18 08:56:54 +0100
committerbinary <me@rgoncalves.se>2021-01-18 08:56:54 +0100
commita9f2fde23de7e63efaaf69714bcf6de61b7bb8aa (patch)
tree92a66b90179540a5c5909810cb3b9cc3b63b94c8 /roles/ksplmp
parent1326313cc0c832f08b1c1e2aee9e86776266a1ad (diff)
downloadinfrastructure-a9f2fde23de7e63efaaf69714bcf6de61b7bb8aa.tar.gz
Add KSP LunaMP setup role
Diffstat (limited to 'roles/ksplmp')
-rw-r--r--roles/ksplmp/tasks/main.yml59
-rw-r--r--roles/ksplmp/templates/GeneralSettings.xml.j253
-rw-r--r--roles/ksplmp/vars/main.yml9
3 files changed, 121 insertions, 0 deletions
diff --git a/roles/ksplmp/tasks/main.yml b/roles/ksplmp/tasks/main.yml
new file mode 100644
index 0000000..8356c46
--- /dev/null
+++ b/roles/ksplmp/tasks/main.yml
@@ -0,0 +1,59 @@
+
+# ksplmp ~~ roles/ksplmpp/tasks/main.yml
+# kerbal space program lunar multiplayer server)
+
+---
+
+- name: create ksp group
+ group:
+ name: "{{ ksplmp_group }}"
+ state: present
+
+- name: create ksp user
+ user:
+ name: "{{ ksplmp_user }}"
+ group: "{{ ksplmp_group }}"
+
+- name: create ksp directory
+ file:
+ path: "{{ ksplmp_dir }}"
+ owner: "{{ ksplmp_user }}"
+ group: "{{ ksplmp_user }}"
+ mode: 0700
+ state: directory
+
+- name: install mono package
+ package: name=mono state=present
+
+- name: download ksplmp server
+ get_url:
+ url: "{{ ksplmp_url }}"
+ dest: "{{ ksplmp_dir }}/ksplmp.zip"
+ owner: "{{ ksplmp_user }}"
+
+- name: unzip lunar-multiplayer server files
+ unarchive:
+ src: "{{ ksplmp_dir }}/ksplmp.zip"
+ dest: "{{ ksplmp_dir }}"
+ remote_src: true
+
+- name: move server files in ksplmp root directory
+ shell: "cp -r {{ ksplmp_dir }}/LMPServer/* {{ ksplmp_dir }}"
+ become: true
+ become_user: "{{ ksplmp_user }}"
+
+- name: generate general settings configuration file
+ template:
+ src: GeneralSettings.xml.j2
+ dest: "{{ ksplmp_dir }}/Config/GeneralSettings.xml"
+ owner: "{{ ksplmp_user }}"
+ group: "{{ ksplmp_group }}"
+
+- name: create, enabled and start ksplmp service
+ include_role: name=rc
+ vars:
+ rc_cmd: mono
+ rc_args: "{{ ksplmp_dir }}/Server.exe"
+ rc_user: "{{ ksplmp_user }}:{{ ksplmp_group }}"
+ rc_dir: "{{ ksplmp_dir }}"
+ rc_name: ksplmp
diff --git a/roles/ksplmp/templates/GeneralSettings.xml.j2 b/roles/ksplmp/templates/GeneralSettings.xml.j2
new file mode 100644
index 0000000..ae945d6
--- /dev/null
+++ b/roles/ksplmp/templates/GeneralSettings.xml.j2
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-16"?>
+<GeneralSettingsDefinition xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <!--Name of the server. Max 30 char-->
+ <ServerName>{{ global.domain_name }}'s KSP Luna Server!</ServerName>
+ <!--Description of the server. Max 200 char-->
+ <Description>Luna Server Description</Description>
+ <!--By default this will be given by the masterserver but you can override it here if you want. Max 2 char-->
+ <CountryCode></CountryCode>
+ <!--Website text to display (discord, website, forum, etc). Can be left empty. Max 15 char-->
+ <WebsiteText>http://{{ global.domain_name }}</WebsiteText>
+ <!--Actual website URL. Can be left empty. Max 60 char-->
+ <Website>lunamultiplayer.com</Website>
+ <!--Password for the server. Leave it empty if you want to make a public server. Max 30 chars-->
+ <Password></Password>
+ <!--Admin password for the server. Leave it empty if you don't want to allow server administration from KSP. Max 30 chars-->
+ <AdminPassword></AdminPassword>
+ <!--Specify the server's MOTD (message of the day). 255 chars max-->
+ <ServerMotd>Hi %Name%!
+ Welcome to %ServerName%.
+ Online players: %PlayerCount%</ServerMotd>
+ <!--Writes the server's MOTD (message of the day) in the chat of the user who joins-->
+ <PrintMotdInChat>true</PrintMotdInChat>
+ <!--Maximum amount of players that can join the server.-->
+ <MaxPlayers>8</MaxPlayers>
+ <!--Maximum length of a username.-->
+ <MaxUsernameLength>15</MaxUsernameLength>
+ <!--Specify in minutes how often /dekessler automatically runs. 0 = Disabled-->
+ <AutoDekessler>0.5</AutoDekessler>
+ <!--Specify in minutes how often /nukeksc automatically runs. 0 = Disabled-->
+ <AutoNuke>0</AutoNuke>
+ <!--Enable use of Cheats in-game.-->
+ <Cheats>true</Cheats>
+ <!--Allow players to sack kerbals-->
+ <AllowSackKerbals>false</AllowSackKerbals>
+ <!--Specify the Name that will appear when you send a message using the server's console.-->
+ <ConsoleIdentifier>Server</ConsoleIdentifier>
+ <!--Specify the gameplay difficulty of the server. Values: Easy, Normal, Moderate, Hard, Custom-->
+ <GameDifficulty>Normal</GameDifficulty>
+ <!--Specify the game Type. Values: Sandbox, Career, Science-->
+ <GameMode>Science</GameMode>
+ <!--Enable mod control. WARNING: Only consider turning off mod control for private servers. The game will constantly complain about missing parts if there are missing mods. Read this wiki page: https://github.com/LunaMultiplayer/LunaMultiplayer/wiki/Mod-file to understand how it works-->
+ <ModControl>true</ModControl>
+ <!--How many untracked asteroids to spawn into the universe. 0 = Disabled-->
+ <NumberOfAsteroids>5</NumberOfAsteroids>
+ <!--How many untracked comets to spawn into the universe. 0 = Disabled-->
+ <NumberOfComets>5</NumberOfComets>
+ <!--Terrain quality. All clients will need to have this setting in their KSP to avoid terrain differences. Values: Low, Default, High, Ignore. Using 'Ignore' might create bugs-->
+ <TerrainQuality>High</TerrainQuality>
+ <!--Specify the minimum distance in which vessels can interact with eachother at the launch pad and runway-->
+ <SafetyBubbleDistance>100</SafetyBubbleDistance>
+ <!--Max number of parts that a vessel can have when spawning-->
+ <MaxVesselParts>600</MaxVesselParts>
+</GeneralSettingsDefinition>
diff --git a/roles/ksplmp/vars/main.yml b/roles/ksplmp/vars/main.yml
new file mode 100644
index 0000000..f0f9b32
--- /dev/null
+++ b/roles/ksplmp/vars/main.yml
@@ -0,0 +1,9 @@
+
+# ksplmp ~~ roles/ksplmp/vars/main.yml
+
+---
+
+ksplmp_user: "ksplmp"
+ksplmp_group: "ksplmp"
+ksplmp_dir: "/data/ksplmp"
+ksplmp_url: "https://github.com/LunaMultiplayer/LunaMultiplayer/releases/download/0.27.0/LunaMultiplayer-Release.zip"
remember that computers suck.