author | Luke Hoersten <luke@hoersten.org> |
Mon, 07 Oct 2024 23:31:51 -0500 | |
changeset 239 | c3e3169399a8 |
parent 178 | 0f99f298361d |
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 |
174 | 5 |
user: name="{{minecraft_user}}" home="{{minecraft_parent_dir}}/minecraft" shell="/bin/false" system="yes" |
19 | 6 |
|
178 | 7 |
- name: install java |
177 | 8 |
become: yes |
239
c3e3169399a8
Updated java version and disabled geyser due to too old jde.
Luke Hoersten <luke@hoersten.org>
parents:
178
diff
changeset
|
9 |
apt: name="openjdk-21-jre-headless" |
19 | 10 |
|
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
11 |
- name: create minecraft dir |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
12 |
become: yes |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
13 |
file: |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
14 |
path: "{{minecraft_dir}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
15 |
owner: "{{minecraft_user}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
16 |
group: "{{minecraft_user}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
17 |
mode: "0755" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
18 |
state: "directory" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
19 |
|
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
20 |
- name: download minecraft |
19 | 21 |
become: yes |
22 |
get_url: |
|
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
23 |
url: "{{minecraft_url}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
24 |
dest: "{{minecraft_dir}}/server.jar" |
19 | 25 |
mode: "0755" |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
26 |
notify: restart minecraft |
19 | 27 |
|
155
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
28 |
- name: configure minecraft eula |
19 | 29 |
become: yes |
30 |
copy: |
|
163 | 31 |
src: "eula.txt" |
32 |
dest: "{{minecraft_dir}}/eula.txt" |
|
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
33 |
owner: "{{minecraft_user}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
34 |
group: "{{minecraft_user}}" |
155
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
35 |
notify: restart minecraft |
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
36 |
|
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
37 |
- name: configure minecraft ops |
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
38 |
become: yes |
163 | 39 |
copy: |
40 |
src: "{{minecraft_ops_file}}" |
|
155
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
41 |
dest: "{{minecraft_dir}}/ops.json" |
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
42 |
owner: "{{minecraft_user}}" |
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
43 |
group: "{{minecraft_user}}" |
163 | 44 |
when: minecraft_ops_file is defined |
45 |
notify: restart minecraft |
|
46 |
||
47 |
- name: configure minecraft whitelist |
|
48 |
become: yes |
|
49 |
copy: |
|
50 |
src: "{{minecraft_whitelist_file}}" |
|
51 |
dest: "{{minecraft_dir}}/whitelist.json" |
|
52 |
owner: "{{minecraft_user}}" |
|
53 |
group: "{{minecraft_user}}" |
|
54 |
when: minecraft_whitelist_file is defined and minecraft_whitelist == "true" |
|
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
55 |
notify: restart minecraft |
19 | 56 |
|
162
a7a64ed07204
Added Geyser minecraft plugin. Cleaned up minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
156
diff
changeset
|
57 |
- name: create minecraft plugins dir |
a7a64ed07204
Added Geyser minecraft plugin. Cleaned up minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
156
diff
changeset
|
58 |
become: yes |
a7a64ed07204
Added Geyser minecraft plugin. Cleaned up minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
156
diff
changeset
|
59 |
file: |
a7a64ed07204
Added Geyser minecraft plugin. Cleaned up minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
156
diff
changeset
|
60 |
path: "{{minecraft_dir}}/plugins" |
a7a64ed07204
Added Geyser minecraft plugin. Cleaned up minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
156
diff
changeset
|
61 |
owner: "{{minecraft_user}}" |
a7a64ed07204
Added Geyser minecraft plugin. Cleaned up minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
156
diff
changeset
|
62 |
group: "{{minecraft_user}}" |
a7a64ed07204
Added Geyser minecraft plugin. Cleaned up minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
156
diff
changeset
|
63 |
mode: "0755" |
a7a64ed07204
Added Geyser minecraft plugin. Cleaned up minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
156
diff
changeset
|
64 |
state: "directory" |
a7a64ed07204
Added Geyser minecraft plugin. Cleaned up minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
156
diff
changeset
|
65 |
|
125
5a298f7b44f5
Added dynmap to minecraft.
Luke Hoersten <luke@hoersten.org>
parents:
112
diff
changeset
|
66 |
- name: install plugins |
162
a7a64ed07204
Added Geyser minecraft plugin. Cleaned up minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
156
diff
changeset
|
67 |
include_tasks: "{{item}}.yaml" |
164
ae19501f5251
Updated minecraft to be multi-world and minimized world size.
Luke Hoersten <luke@hoersten.org>
parents:
163
diff
changeset
|
68 |
loop: "{{minecreat_plugins_enabled}}" |
125
5a298f7b44f5
Added dynmap to minecraft.
Luke Hoersten <luke@hoersten.org>
parents:
112
diff
changeset
|
69 |
|
107
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
70 |
- 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
|
71 |
become: yes |
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
72 |
file: |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
73 |
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
|
74 |
state: "touch" |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
75 |
access_time: "preserve" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
76 |
modification_time: "preserve" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
77 |
owner: "{{minecraft_user}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
78 |
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
|
79 |
|
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
80 |
- name: configure server.properties |
33 | 81 |
become: yes |
82 |
lineinfile: |
|
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
83 |
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
|
84 |
regexp: "^{{item.key}}=" |
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
85 |
line: "{{item.key}}={{item.value}}" |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
86 |
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
|
87 |
loop: |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
88 |
- {key: "motd", value: "{{minecraft_motd}}"} |
164
ae19501f5251
Updated minecraft to be multi-world and minimized world size.
Luke Hoersten <luke@hoersten.org>
parents:
163
diff
changeset
|
89 |
- {key: "level-name", value: "{{minecraft_world_name}}"} |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
90 |
- {key: "level-seed", value: "{{minecraft_seed}}"} |
153 | 91 |
- {key: "difficulty", value: "{{minecraft_difficulty}}"} |
163 | 92 |
- {key: "white-list", value: "{{minecraft_whitelist}}"} |
93 |
- {key: "enforce-whitelist", value: "{{minecraft_whitelist}}"} |
|
94 |
- {key: "view-distance", value: "{{minecraft_view_distance}}"} |
|
95 |
- {key: "snooper-enabled", value: "false"} |
|
19 | 96 |
|
97 |
- name: install systemd service |
|
98 |
become: yes |
|
99 |
template: |
|
164
ae19501f5251
Updated minecraft to be multi-world and minimized world size.
Luke Hoersten <luke@hoersten.org>
parents:
163
diff
changeset
|
100 |
src: "[email protected]" |
ae19501f5251
Updated minecraft to be multi-world and minimized world size.
Luke Hoersten <luke@hoersten.org>
parents:
163
diff
changeset
|
101 |
dest: "/lib/systemd/system/[email protected]" |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
102 |
notify: restart minecraft |
19 | 103 |
|
104 |
- name: ensure service is started |
|
105 |
become: yes |
|
164
ae19501f5251
Updated minecraft to be multi-world and minimized world size.
Luke Hoersten <luke@hoersten.org>
parents:
163
diff
changeset
|
106 |
systemd: name="minecraft@{{minecraft_world_name}}.service" enabled="yes" state="started" |