From a9f2fde23de7e63efaaf69714bcf6de61b7bb8aa Mon Sep 17 00:00:00 2001 From: binary Date: Mon, 18 Jan 2021 08:56:54 +0100 Subject: Add KSP LunaMP setup role --- roles/ksplmp/tasks/main.yml | 59 +++++++++++++++++++++++++++ roles/ksplmp/templates/GeneralSettings.xml.j2 | 53 ++++++++++++++++++++++++ roles/ksplmp/vars/main.yml | 9 ++++ 3 files changed, 121 insertions(+) create mode 100644 roles/ksplmp/tasks/main.yml create mode 100644 roles/ksplmp/templates/GeneralSettings.xml.j2 create mode 100644 roles/ksplmp/vars/main.yml (limited to 'roles') 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 @@ + + + + {{ global.domain_name }}'s KSP Luna Server! + + Luna Server Description + + + + http://{{ global.domain_name }} + + lunamultiplayer.com + + + + + + Hi %Name%! + Welcome to %ServerName%. + Online players: %PlayerCount% + + true + + 8 + + 15 + + 0.5 + + 0 + + true + + false + + Server + + Normal + + Science + + true + + 5 + + 5 + + High + + 100 + + 600 + 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" -- cgit v1.2.3