aboutsummaryrefslogtreecommitdiffstats
path: root/roles/ksplmp/tasks/main.yml
blob: 8356c46f1d83b8669d0fed85a2f5bafcecde3359 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
remember that computers suck.