aboutsummaryrefslogtreecommitdiffstats
path: root/roles/minecraft/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/minecraft/tasks/main.yml')
-rw-r--r--roles/minecraft/tasks/main.yml32
1 files changed, 28 insertions, 4 deletions
diff --git a/roles/minecraft/tasks/main.yml b/roles/minecraft/tasks/main.yml
index 1b9142e..d75ff07 100644
--- a/roles/minecraft/tasks/main.yml
+++ b/roles/minecraft/tasks/main.yml
@@ -3,10 +3,15 @@
---
+- name: create minecraft group
+ group:
+ name: "{{ minecraft_group }}"
+ state: present
+
- name: create minecraft user
user:
name: "{{ minecraft_user }}"
- group: "{{ minecraft_user }}"
+ group: "{{ minecraft_group }}"
- name: create minecraft directory
file:
@@ -24,8 +29,27 @@
- name: enable eula
lineinfile:
- file: "{{ minecraft_dir }}/eula.txt"
+ path: "{{ minecraft_dir }}/eula.txt"
regexp: "^eula=false"
line: eula=true
- become: true
- become_user: "{{ minecraft_user }}"
+ owner: "{{ minecraft_user }}"
+ group: "{{ minecraft_group }}"
+ mode: 0600
+ create: true
+
+- name: generate launch script
+ template:
+ src: launch.sh.j2
+ dest: "{{ minecraft_dir }}/launch.sh"
+ owner: "{{ minecraft_user }}"
+ group: "{{ minecraft_group }}"
+ mode: 0700
+
+- name: create service minecraft server
+ include_role: name=rc
+ vars:
+ rc_cmd: java
+ rc_args: "-jar -Xms{{ minecraft_ram }} -Xmx{{ minecraft_ram }} -XX:+UseG1GC -jar server.jar nogui"
+ rc_user: "{{ minecraft_user }}:{{ minecraft_group }}"
+ rc_dir: "{{ minecraft_dir }}"
+ rc_name: minecraft
remember that computers suck.