author | Luke Hoersten <luke@hoersten.org> |
Sat, 16 May 2020 12:57:11 -0500 | |
changeset 29 | a0f74d2bb1d1 |
parent 27 | 8fddefdd948b |
permissions | -rw-r--r-- |
19 | 1 |
--- |
2 |
||
3 |
- name: add minecract user |
|
4 |
become: yes |
|
5 |
user: name="{{minecraft_user}}" home="{{minecraft_dir}}" |
|
6 |
||
7 |
- name: install jre |
|
8 |
become: yes |
|
9 |
apt: name="default-jre-headless" |
|
10 |
||
11 |
- name: download minecraft |
|
12 |
become: yes |
|
13 |
get_url: |
|
14 |
url: "{{minecraft_url}}" |
|
15 |
dest: "{{minecraft_dir}}/server.jar" |
|
16 |
mode: "0755" |
|
17 |
notify: restart minecraft |
|
18 |
||
20
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
19 |
- name: configure eula and ops |
19 | 20 |
become: yes |
21 |
copy: |
|
20
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
22 |
src: "{{item}}" |
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
23 |
dest: "{{minecraft_dir}}/{{item}}" |
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
24 |
owner: "{{minecraft_user}}" |
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
25 |
group: "{{minecraft_user}}" |
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
26 |
loop: |
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
27 |
- "eula.txt" |
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
28 |
- "ops.json" |
27 | 29 |
notify: restart minecraft |
19 | 30 |
|
27 | 31 |
# minecraft server writes a timtestamp to the config every time it starts so this always generates a change. |
19 | 32 |
- name: configure minecraft |
33 |
become: yes |
|
34 |
template: |
|
35 |
src: "server.properties.j2" |
|
36 |
dest: "{{minecraft_dir}}/server.properties" |
|
37 |
owner: "{{minecraft_user}}" |
|
38 |
group: "{{minecraft_user}}" |
|
27 | 39 |
changed_when: false |
19 | 40 |
|
41 |
- name: install systemd service |
|
42 |
become: yes |
|
43 |
template: |
|
44 |
src: "minecraft.service.j2" |
|
45 |
dest: "/lib/systemd/system/minecraft.service" |
|
27 | 46 |
notify: restart minecraft |
19 | 47 |
|
48 |
- name: ensure service is started |
|
49 |
become: yes |
|
50 |
systemd: name="minecraft.service" enabled="yes" state="started" |