From aea6b114e050545ccc8b953c579d53c9158e238b Mon Sep 17 00:00:00 2001 From: binary Date: Sun, 15 Nov 2020 17:26:32 +0100 Subject: I'm so lazy so ignore this cimment this time pls --- roles/minecraft/tasks/main.yml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 roles/minecraft/tasks/main.yml (limited to 'roles/minecraft/tasks') 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 }}" + -- cgit v1.2.3