author | Luke Hoersten <luke@hoersten.org> |
Fri, 03 Jul 2020 12:00:27 -0500 | |
changeset 111 | 1c1a911b26aa |
parent 107 | 9057b9f9ced8 |
permissions | -rw-r--r-- |
19 | 1 |
--- |
2 |
||
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
3 |
- name: add minecraft user |
19 | 4 |
become: yes |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
5 |
user: name="{{minecraft_user}}" home="{{minecraft_dir}}" |
19 | 6 |
|
7 |
- name: install jre |
|
8 |
become: yes |
|
9 |
apt: name="default-jre-headless" |
|
10 |
||
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
11 |
- name: set minecraft fork |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
12 |
set_fact: minecraft_url="{{minecraft_vanilla_url}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
13 |
when: minecraft_fork == "vanilla" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
14 |
|
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
15 |
- name: set minecraft fork |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
16 |
set_fact: minecraft_url="{{minecraft_paper_url}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
17 |
when: minecraft_fork == "paper" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
18 |
|
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
19 |
- name: create minecraft dir |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
20 |
become: yes |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
21 |
file: |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
22 |
path: "{{minecraft_dir}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
23 |
owner: "{{minecraft_user}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
24 |
group: "{{minecraft_user}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
25 |
mode: "0755" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
26 |
state: "directory" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
27 |
|
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
28 |
- name: download minecraft |
19 | 29 |
become: yes |
30 |
get_url: |
|
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
31 |
url: "{{minecraft_url}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
32 |
dest: "{{minecraft_dir}}/server.jar" |
19 | 33 |
mode: "0755" |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
34 |
notify: restart minecraft |
19 | 35 |
|
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
36 |
- name: configure minecraft eula and ops |
19 | 37 |
become: yes |
38 |
copy: |
|
20
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
39 |
src: "{{item}}" |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
40 |
dest: "{{minecraft_dir}}/{{item}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
41 |
owner: "{{minecraft_user}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
42 |
group: "{{minecraft_user}}" |
20
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
43 |
loop: |
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
44 |
- "eula.txt" |
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
45 |
- "ops.json" |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
46 |
notify: restart minecraft |
19 | 47 |
|
107
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
48 |
- name: create server.properties |
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
49 |
become: yes |
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
50 |
file: |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
51 |
path: "{{minecraft_dir}}/server.properties" |
107
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
52 |
state: "touch" |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
53 |
access_time: "preserve" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
54 |
modification_time: "preserve" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
55 |
owner: "{{minecraft_user}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
56 |
group: "{{minecraft_user}}" |
107
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
57 |
|
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
58 |
- name: configure server.properties |
33 | 59 |
become: yes |
60 |
lineinfile: |
|
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
61 |
path: "{{minecraft_dir}}/server.properties" |
107
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
62 |
regexp: "^{{item.key}}=" |
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
63 |
line: "{{item.key}}={{item.value}}" |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
64 |
notify: restart minecraft |
107
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
65 |
loop: |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
66 |
- {key: "motd", value: "{{minecraft_motd}}"} |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
67 |
- {key: "level-seed", value: "{{minecraft_seed}}"} |
19 | 68 |
|
69 |
- name: install systemd service |
|
70 |
become: yes |
|
71 |
template: |
|
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
72 |
src: "minecraft.service.j2" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
73 |
dest: "/lib/systemd/system/minecraft.service" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
74 |
notify: restart minecraft |
19 | 75 |
|
76 |
- name: ensure service is started |
|
77 |
become: yes |
|
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
78 |
systemd: name="minecraft.service" enabled="yes" state="started" |