author | Luke Hoersten <luke@hoersten.org> |
Sat, 03 Jul 2021 11:16:17 -0500 | |
changeset 155 | 4d45841961e7 |
parent 153 | dbc589234a49 |
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 |
|
152
740231770c7c
Updated minecraft to 1.17.
Luke Hoersten <luke@hoersten.org>
parents:
125
diff
changeset
|
7 |
- name: install adoptopenjdk |
740231770c7c
Updated minecraft to 1.17.
Luke Hoersten <luke@hoersten.org>
parents:
125
diff
changeset
|
8 |
include_tasks: adoptopenjdk.yaml |
19 | 9 |
|
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
10 |
- name: set minecraft fork |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
11 |
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
|
12 |
when: minecraft_fork == "vanilla" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
13 |
|
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
14 |
- name: set minecraft fork |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
15 |
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
|
16 |
when: minecraft_fork == "paper" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
17 |
|
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: |
|
20
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
38 |
src: "{{item}}" |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
39 |
dest: "{{minecraft_dir}}/{{item}}" |
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}}" |
20
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
42 |
loop: |
9cacee5eec83
Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents:
19
diff
changeset
|
43 |
- "eula.txt" |
155
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
44 |
notify: restart minecraft |
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
45 |
|
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
46 |
- name: configure minecraft ops |
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
47 |
become: yes |
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
48 |
template: |
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
49 |
src: "ops.json.j2" |
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
50 |
dest: "{{minecraft_dir}}/ops.json" |
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
51 |
owner: "{{minecraft_user}}" |
4d45841961e7
Added ops template to main.
Luke Hoersten <luke@hoersten.org>
parents:
153
diff
changeset
|
52 |
group: "{{minecraft_user}}" |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
53 |
notify: restart minecraft |
19 | 54 |
|
125
5a298f7b44f5
Added dynmap to minecraft.
Luke Hoersten <luke@hoersten.org>
parents:
112
diff
changeset
|
55 |
- name: install plugins |
5a298f7b44f5
Added dynmap to minecraft.
Luke Hoersten <luke@hoersten.org>
parents:
112
diff
changeset
|
56 |
include_tasks: dynmap.yaml |
5a298f7b44f5
Added dynmap to minecraft.
Luke Hoersten <luke@hoersten.org>
parents:
112
diff
changeset
|
57 |
when: minecraft_fork == "paper" |
5a298f7b44f5
Added dynmap to minecraft.
Luke Hoersten <luke@hoersten.org>
parents:
112
diff
changeset
|
58 |
|
107
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
59 |
- 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
|
60 |
become: yes |
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
61 |
file: |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
62 |
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
|
63 |
state: "touch" |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
64 |
access_time: "preserve" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
65 |
modification_time: "preserve" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
66 |
owner: "{{minecraft_user}}" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
67 |
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
|
68 |
|
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
69 |
- name: configure server.properties |
33 | 70 |
become: yes |
71 |
lineinfile: |
|
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
72 |
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
|
73 |
regexp: "^{{item.key}}=" |
9057b9f9ced8
MC separate world files dont work. Had to move main dir.
Luke Hoersten <luke@hoersten.org>
parents:
59
diff
changeset
|
74 |
line: "{{item.key}}={{item.value}}" |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
75 |
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
|
76 |
loop: |
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
77 |
- {key: "motd", value: "{{minecraft_motd}}"} |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
78 |
- {key: "level-seed", value: "{{minecraft_seed}}"} |
153 | 79 |
- {key: "difficulty", value: "{{minecraft_difficulty}}"} |
19 | 80 |
|
81 |
- name: install systemd service |
|
82 |
become: yes |
|
83 |
template: |
|
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
84 |
src: "minecraft.service.j2" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
85 |
dest: "/lib/systemd/system/minecraft.service" |
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
86 |
notify: restart minecraft |
19 | 87 |
|
88 |
- name: ensure service is started |
|
89 |
become: yes |
|
111
1c1a911b26aa
Made minecraft role support vanilla and paper forks.
Luke Hoersten <luke@hoersten.org>
parents:
107
diff
changeset
|
90 |
systemd: name="minecraft.service" enabled="yes" state="started" |