diff options
author | binary <me@rgoncalves.se> | 2020-11-21 16:16:02 +0100 |
---|---|---|
committer | binary <me@rgoncalves.se> | 2020-11-21 16:16:02 +0100 |
commit | 9ab92a79b7124eebfb4604f61975c7ac6c9c1304 (patch) | |
tree | af33df01e247fb78d4fb830a79f7e1b0dec3c6e9 /roles/minecraft/tasks | |
parent | 44ede44c438d1a9d10b90032d8decb42bfe5ce49 (diff) | |
download | infrastructure-9ab92a79b7124eebfb4604f61975c7ac6c9c1304.tar.gz |
Add openrc for minecraft.
Diffstat (limited to 'roles/minecraft/tasks')
-rw-r--r-- | roles/minecraft/tasks/main.yml | 32 |
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 |