Renamed papermc role to minecraft.
authorLuke Hoersten <luke@hoersten.org>
Fri, 03 Jul 2020 12:01:00 -0500
changeset 112 22c06d6916bf
parent 111 1c1a911b26aa
child 113 d843011c249d
Renamed papermc role to minecraft.
minecraft/defaults/main.yaml
minecraft/files/eula.txt
minecraft/files/ops.json
minecraft/handlers/main.yaml
minecraft/tasks/main.yaml
minecraft/templates/minecraft.service.j2
minecraft/vars/main.yaml
papermc/defaults/main.yaml
papermc/files/eula.txt
papermc/files/ops.json
papermc/handlers/main.yaml
papermc/tasks/main.yaml
papermc/templates/minecraft.service.j2
papermc/vars/main.yaml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/minecraft/defaults/main.yaml	Fri Jul 03 12:01:00 2020 -0500
@@ -0,0 +1,12 @@
+---
+
+minecraft_user: "minecraft"
+minecraft_fork: "vanilla" # paper
+minecraft_parent_dir: "/opt"
+minecraft_motd: "A Minecraft Server"
+minecraft_mem: "2G"
+minecraft_seed: ""
+
+minecraft_paper_version: "1.16.1"
+minecraft_paper_build: "34"
+minecraft_vanilla_hash: "a412fd69db1f81db3f511c1463fd304675244077"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/minecraft/files/eula.txt	Fri Jul 03 12:01:00 2020 -0500
@@ -0,0 +1,1 @@
+eula=true
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/minecraft/files/ops.json	Fri Jul 03 12:01:00 2020 -0500
@@ -0,0 +1,8 @@
+[
+  {
+    "uuid": "98827ef9-601c-49fd-b575-abc8de019854",
+    "name": "Lukemute",
+    "level": 4,
+    "bypassesPlayerLimit": true
+  }
+]
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/minecraft/handlers/main.yaml	Fri Jul 03 12:01:00 2020 -0500
@@ -0,0 +1,5 @@
+---
+
+- name: restart minecraft
+  become: yes
+  systemd: name="minecraft.service" state="restarted" daemon_reload="yes"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/minecraft/tasks/main.yaml	Fri Jul 03 12:01:00 2020 -0500
@@ -0,0 +1,78 @@
+---
+
+- name: add minecraft user
+  become: yes
+  user: name="{{minecraft_user}}" home="{{minecraft_dir}}"
+
+- name: install jre
+  become: yes
+  apt: name="default-jre-headless"
+
+- name: set minecraft fork
+  set_fact: minecraft_url="{{minecraft_vanilla_url}}"
+  when: minecraft_fork == "vanilla"
+
+- name: set minecraft fork
+  set_fact: minecraft_url="{{minecraft_paper_url}}"
+  when: minecraft_fork == "paper"
+
+- name: create minecraft dir
+  become: yes
+  file:
+    path: "{{minecraft_dir}}"
+    owner: "{{minecraft_user}}"
+    group: "{{minecraft_user}}"
+    mode: "0755"
+    state: "directory"
+
+- name: download minecraft
+  become: yes
+  get_url:
+    url: "{{minecraft_url}}"
+    dest: "{{minecraft_dir}}/server.jar"
+    mode: "0755"
+  notify: restart minecraft
+
+- name: configure minecraft eula and ops
+  become: yes
+  copy:
+    src: "{{item}}"
+    dest: "{{minecraft_dir}}/{{item}}"
+    owner: "{{minecraft_user}}"
+    group: "{{minecraft_user}}"
+  loop:
+    - "eula.txt"
+    - "ops.json"
+  notify: restart minecraft
+
+- name: create server.properties
+  become: yes
+  file:
+    path: "{{minecraft_dir}}/server.properties"
+    state: "touch"
+    access_time: "preserve"
+    modification_time: "preserve"
+    owner: "{{minecraft_user}}"
+    group: "{{minecraft_user}}"
+
+- name: configure server.properties
+  become: yes
+  lineinfile:
+    path: "{{minecraft_dir}}/server.properties"
+    regexp: "^{{item.key}}="
+    line: "{{item.key}}={{item.value}}"
+  notify: restart minecraft
+  loop:
+    - {key: "motd", value: "{{minecraft_motd}}"}
+    - {key: "level-seed", value: "{{minecraft_seed}}"}
+
+- name: install systemd service
+  become: yes
+  template:
+    src: "minecraft.service.j2"
+    dest: "/lib/systemd/system/minecraft.service"
+  notify: restart minecraft
+
+- name: ensure service is started
+  become: yes
+  systemd: name="minecraft.service" enabled="yes" state="started"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/minecraft/templates/minecraft.service.j2	Fri Jul 03 12:01:00 2020 -0500
@@ -0,0 +1,22 @@
+[Unit]
+Description=Minecraft Server
+Documentation=https://minecraft.gamepedia.com/Tutorials/Setting_up_a_server
+
+Wants=network.target
+After=network.target
+
+[Service]
+User={{minecraft_user}}
+Group={{minecraft_user}}
+WorkingDirectory={{minecraft_dir}}
+Restart=on-failure
+RestartSec=20 5
+ExecStart=/usr/bin/java -Xms{{minecraft_mem}} -Xmx{{minecraft_mem}} -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
+
+PrivateTmp=true
+ProtectSystem=full
+NoNewPrivileges=true
+PrivateDevices=true
+
+[Install]
+WantedBy=multi-user.target
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/minecraft/vars/main.yaml	Fri Jul 03 12:01:00 2020 -0500
@@ -0,0 +1,5 @@
+---
+
+minecraft_dir: "{{minecraft_parent_dir}}/minecraft/{{minecraft_fork}}"
+minecraft_paper_url: "https://papermc.io/api/v1/paper/{{minecraft_paper_version}}/{{minecraft_paper_build}}/download"
+minecraft_vanilla_url: "https://launcher.mojang.com/v1/objects/{{minecraft_vanilla_hash}}/server.jar"
--- a/papermc/defaults/main.yaml	Fri Jul 03 12:00:27 2020 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
----
-
-minecraft_user: "minecraft"
-minecraft_fork: "vanilla" # paper
-minecraft_parent_dir: "/opt"
-minecraft_motd: "A Minecraft Server"
-minecraft_mem: "2G"
-minecraft_seed: ""
-
-minecraft_paper_version: "1.16.1"
-minecraft_paper_build: "34"
-minecraft_vanilla_hash: "a412fd69db1f81db3f511c1463fd304675244077"
--- a/papermc/files/eula.txt	Fri Jul 03 12:00:27 2020 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-eula=true
--- a/papermc/files/ops.json	Fri Jul 03 12:00:27 2020 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-[
-  {
-    "uuid": "98827ef9-601c-49fd-b575-abc8de019854",
-    "name": "Lukemute",
-    "level": 4,
-    "bypassesPlayerLimit": true
-  }
-]
\ No newline at end of file
--- a/papermc/handlers/main.yaml	Fri Jul 03 12:00:27 2020 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
----
-
-- name: restart minecraft
-  become: yes
-  systemd: name="minecraft.service" state="restarted" daemon_reload="yes"
--- a/papermc/tasks/main.yaml	Fri Jul 03 12:00:27 2020 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
----
-
-- name: add minecraft user
-  become: yes
-  user: name="{{minecraft_user}}" home="{{minecraft_dir}}"
-
-- name: install jre
-  become: yes
-  apt: name="default-jre-headless"
-
-- name: set minecraft fork
-  set_fact: minecraft_url="{{minecraft_vanilla_url}}"
-  when: minecraft_fork == "vanilla"
-
-- name: set minecraft fork
-  set_fact: minecraft_url="{{minecraft_paper_url}}"
-  when: minecraft_fork == "paper"
-
-- name: create minecraft dir
-  become: yes
-  file:
-    path: "{{minecraft_dir}}"
-    owner: "{{minecraft_user}}"
-    group: "{{minecraft_user}}"
-    mode: "0755"
-    state: "directory"
-
-- name: download minecraft
-  become: yes
-  get_url:
-    url: "{{minecraft_url}}"
-    dest: "{{minecraft_dir}}/server.jar"
-    mode: "0755"
-  notify: restart minecraft
-
-- name: configure minecraft eula and ops
-  become: yes
-  copy:
-    src: "{{item}}"
-    dest: "{{minecraft_dir}}/{{item}}"
-    owner: "{{minecraft_user}}"
-    group: "{{minecraft_user}}"
-  loop:
-    - "eula.txt"
-    - "ops.json"
-  notify: restart minecraft
-
-- name: create server.properties
-  become: yes
-  file:
-    path: "{{minecraft_dir}}/server.properties"
-    state: "touch"
-    access_time: "preserve"
-    modification_time: "preserve"
-    owner: "{{minecraft_user}}"
-    group: "{{minecraft_user}}"
-
-- name: configure server.properties
-  become: yes
-  lineinfile:
-    path: "{{minecraft_dir}}/server.properties"
-    regexp: "^{{item.key}}="
-    line: "{{item.key}}={{item.value}}"
-  notify: restart minecraft
-  loop:
-    - {key: "motd", value: "{{minecraft_motd}}"}
-    - {key: "level-seed", value: "{{minecraft_seed}}"}
-
-- name: install systemd service
-  become: yes
-  template:
-    src: "minecraft.service.j2"
-    dest: "/lib/systemd/system/minecraft.service"
-  notify: restart minecraft
-
-- name: ensure service is started
-  become: yes
-  systemd: name="minecraft.service" enabled="yes" state="started"
--- a/papermc/templates/minecraft.service.j2	Fri Jul 03 12:00:27 2020 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-[Unit]
-Description=Minecraft Server
-Documentation=https://minecraft.gamepedia.com/Tutorials/Setting_up_a_server
-
-Wants=network.target
-After=network.target
-
-[Service]
-User={{minecraft_user}}
-Group={{minecraft_user}}
-WorkingDirectory={{minecraft_dir}}
-Restart=on-failure
-RestartSec=20 5
-ExecStart=/usr/bin/java -Xms{{minecraft_mem}} -Xmx{{minecraft_mem}} -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
-
-PrivateTmp=true
-ProtectSystem=full
-NoNewPrivileges=true
-PrivateDevices=true
-
-[Install]
-WantedBy=multi-user.target
--- a/papermc/vars/main.yaml	Fri Jul 03 12:00:27 2020 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
----
-
-minecraft_dir: "{{minecraft_parent_dir}}/minecraft/{{minecraft_fork}}"
-minecraft_paper_url: "https://papermc.io/api/v1/paper/{{minecraft_paper_version}}/{{minecraft_paper_build}}/download"
-minecraft_vanilla_url: "https://launcher.mojang.com/v1/objects/{{minecraft_vanilla_hash}}/server.jar"