diff options
author | binary <me@rgoncalves.se> | 2020-11-15 17:26:32 +0100 |
---|---|---|
committer | binary <me@rgoncalves.se> | 2020-11-15 17:26:32 +0100 |
commit | aea6b114e050545ccc8b953c579d53c9158e238b (patch) | |
tree | 7cbeb2ad790638e433c21f1452dded1588949d2e /roles/minecraft | |
parent | 5bcecbf08db7013ba4de12e492961e2cba6e6b8a (diff) | |
download | infrastructure-aea6b114e050545ccc8b953c579d53c9158e238b.tar.gz |
I'm so lazy so ignore this cimment this time pls
Diffstat (limited to 'roles/minecraft')
-rw-r--r-- | roles/minecraft/tasks/main.yml | 41 | ||||
-rw-r--r-- | roles/minecraft/vars/main.yml | 9 |
2 files changed, 50 insertions, 0 deletions
diff --git a/roles/minecraft/tasks/main.yml b/roles/minecraft/tasks/main.yml new file mode 100644 index 0000000..56a9eed --- /dev/null +++ b/roles/minecraft/tasks/main.yml @@ -0,0 +1,41 @@ + +# minecraft ~~ tasks/main.yml + +--- + +- name: Check java installation + package: + name: openjdk11-jre + state: present + +- name: Create minecraft user + user: + name: "{{ minecraft_user }}" + group: "{{ minecraft_user }}" + +- name: Create minecraft directory + file: + path: "{{ minecraft_dir }}" + owner: "{{ minecraft_user }}" + group: "{{ minecraft_user }}" + state: directory + +- name: Download minecraft server + get_url: + url: "{{ minecraft_url }}" + dest: "{{ minecraft_dir }}/{{ minecraft_bin }}" + owner: "{{ minecraft_user }}" + +- name: Enable eula + become_user: "{{ minecraft_user }}" + shell: echo "eula=true" >> {{ minecraft_dir}}/eula.txt + +- name: Create rc script + include_role: + name: rc + vars: + rc_name: "minecraft" + rc_cmd: "/usr/bin/java" + rc_args: "-jar {{ minecraft_dir }}/{{ minecraft_bin }}" + rc_user: "{{ minecraft_user }}" + diff --git a/roles/minecraft/vars/main.yml b/roles/minecraft/vars/main.yml new file mode 100644 index 0000000..1fc2549 --- /dev/null +++ b/roles/minecraft/vars/main.yml @@ -0,0 +1,9 @@ + +# minecraft ~~ vars/main.yml + +--- + +minecraft_user: "minecraft" +minecraft_dir: "/data/minecraft" +minecraft_bin: "server.jar" +minecraft_url: "https://papermc.io/api/v1/paper/1.16.4/274/download" |