aboutsummaryrefslogtreecommitdiffstats
path: root/roles/minecraft/tasks/main.yml
blob: 56a9eed508c7a2064c41b67c4ed101f090a97ab6 (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

# 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 }}"

remember that computers suck.