24 owner: "{{minecraft_user}}" |
24 owner: "{{minecraft_user}}" |
25 group: "{{minecraft_user}}" |
25 group: "{{minecraft_user}}" |
26 loop: |
26 loop: |
27 - "eula.txt" |
27 - "eula.txt" |
28 - "ops.json" |
28 - "ops.json" |
|
29 notify: restart minecraft |
29 |
30 |
|
31 # minecraft server writes a timtestamp to the config every time it starts so this always generates a change. |
30 - name: configure minecraft |
32 - name: configure minecraft |
31 become: yes |
33 become: yes |
32 template: |
34 template: |
33 src: "server.properties.j2" |
35 src: "server.properties.j2" |
34 dest: "{{minecraft_dir}}/server.properties" |
36 dest: "{{minecraft_dir}}/server.properties" |
35 owner: "{{minecraft_user}}" |
37 owner: "{{minecraft_user}}" |
36 group: "{{minecraft_user}}" |
38 group: "{{minecraft_user}}" |
37 notify: restart minecraft |
39 changed_when: false |
38 |
40 |
39 - name: install systemd service |
41 - name: install systemd service |
40 become: yes |
42 become: yes |
41 template: |
43 template: |
42 src: "minecraft.service.j2" |
44 src: "minecraft.service.j2" |
43 dest: "/lib/systemd/system/minecraft.service" |
45 dest: "/lib/systemd/system/minecraft.service" |
|
46 notify: restart minecraft |
44 |
47 |
45 - name: ensure service is started |
48 - name: ensure service is started |
46 become: yes |
49 become: yes |
47 systemd: name="minecraft.service" enabled="yes" state="started" |
50 systemd: name="minecraft.service" enabled="yes" state="started" |