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