Add new host and enroll it in Paper
Note: currently untested, hopefully shit Just Werks
This commit is contained in:
parent
64a0b2b9ec
commit
abb8090c9b
@ -98,3 +98,4 @@ all:
|
||||
38313431663734343931333462316633643935353038313934663466303834636533616165353961
|
||||
6438356265656532396363323532616437353831613261323037
|
||||
hosts:
|
||||
paper1.9iron.club:
|
||||
|
@ -5,74 +5,17 @@
|
||||
roles:
|
||||
- role: base-backups
|
||||
tags: [ backups ]
|
||||
- hosts: tes3mp1.9iron.club
|
||||
- hosts: paper1.9iron.club
|
||||
roles:
|
||||
- role: tes3mp
|
||||
tags: [ tes3mp ]
|
||||
tasks:
|
||||
- name: Assure CNAME record
|
||||
route53:
|
||||
state: present
|
||||
overwrite: yes
|
||||
zone: 9iron.club
|
||||
type: CNAME
|
||||
record: tes3mp.9iron.club
|
||||
ttl: 3600
|
||||
value: [ "{{ inventory_hostname }}." ]
|
||||
become: yes
|
||||
tags: [ dns ]
|
||||
- hosts: mc1.9iron.club
|
||||
roles:
|
||||
- role: base-backups
|
||||
tags: [ backups ]
|
||||
# - role: minecraft-forge
|
||||
# vars:
|
||||
# mcname: "me5"
|
||||
# mczip: "https://www.9iron.club/files/me5.zip"
|
||||
# mcforge: "1.12.2-14.23.5.2854"
|
||||
# mcmotd: "ME5 is Fun Edition"
|
||||
# mcport: 25565
|
||||
# mcgamemode: 0
|
||||
# mcviewdist: 14
|
||||
# mcleveltype: "default"
|
||||
# tags: [ gameserver, minecraft, me5 ]
|
||||
- role: tmodloader
|
||||
- role: gitweb
|
||||
vars:
|
||||
terraria_difficulty: 1
|
||||
terraria_name: "calamity"
|
||||
terraria_password: "dicks"
|
||||
tags: [ gameserver, terraria, calamity ]
|
||||
tasks:
|
||||
- name: Assure Minecraft CNAME record
|
||||
route53:
|
||||
state: present
|
||||
overwrite: yes
|
||||
zone: 9iron.club
|
||||
type: CNAME
|
||||
record: "me5.mc.9iron.club."
|
||||
ttl: 3600
|
||||
value: [ "{{ inventory_hostname }}." ]
|
||||
become: yes
|
||||
tags: [ dns, minecraft, me5 ]
|
||||
- name: Assure Minecraft SRV record
|
||||
route53:
|
||||
state: present
|
||||
overwrite: yes
|
||||
zone: 9iron.club
|
||||
type: SRV
|
||||
record: "_minecraft._tcp.me5.mc.9iron.club."
|
||||
ttl: 3600
|
||||
value: [ "1 10 25565 {{ inventory_hostname }}." ]
|
||||
become: yes
|
||||
tags: [ dns, minecraft, me5 ]
|
||||
- name: Assure Terraria record
|
||||
route53:
|
||||
state: present
|
||||
overwrite: yes
|
||||
zone: 9iron.club
|
||||
type: CNAME
|
||||
record: "calamity.9iron.club"
|
||||
ttl: 3600
|
||||
value: [ "{{ inventory_hostname }}." ]
|
||||
become: yes
|
||||
tags: [ dns, terraria, calamity ]
|
||||
gitweb_repo: "https://git.9iron.club/salt/thefuck.how"
|
||||
gitweb_url: "thefuck.how"
|
||||
gitweb_webroot: "/var/www/thefuck.how"
|
||||
- role: minecraft-paper
|
||||
vars:
|
||||
paper_name: "thefuckhow"
|
||||
paper_mc_motd: "Brett's new serber"
|
||||
paper_jre_xms: 1024m
|
||||
paper_jre_xmx: 2048m
|
||||
tags: [ gameserver, minecraft, paper ]
|
||||
|
26
roles/minecraft-paper/defaults/main.yml
Normal file
26
roles/minecraft-paper/defaults/main.yml
Normal file
@ -0,0 +1,26 @@
|
||||
# vim:ft=ansible:
|
||||
paper_name: default
|
||||
|
||||
# Service configuration
|
||||
paper_downloadurl: "https://papermc.io/api/v1/paper/1.16.3/latest/download"
|
||||
paper_home: /var/lib/minecraft-paper
|
||||
paper_stopmessage: "Server is going down for maintenance"
|
||||
|
||||
# Java configuration
|
||||
paper_jre_xms: 2048m
|
||||
paper_jre_xmx: 4096m
|
||||
|
||||
# Minecraft configuration
|
||||
paper_mc_difficulty: normal
|
||||
paper_mc_gamemode: 0
|
||||
paper_mc_gensettings: ""
|
||||
paper_mc_leveltype: default
|
||||
paper_mc_maxplayers: 10
|
||||
paper_mc_motd: A new Paper server
|
||||
paper_mc_pvp: "true"
|
||||
paper_mc_spawnprotection: 4
|
||||
paper_mc_viewdist: 12
|
||||
paper_mc_whitelist: "false"
|
||||
|
||||
# Server configuration
|
||||
paper_port: 25565
|
9
roles/minecraft-paper/handlers/main.yml
Normal file
9
roles/minecraft-paper/handlers/main.yml
Normal file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/ansible-playbook
|
||||
# vim:ft=ansible:
|
||||
---
|
||||
- name: "restart paper {{ paper_name }}"
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: "paper@{{ paper_name }}"
|
||||
state: restarted
|
||||
become: yes
|
56
roles/minecraft-paper/tasks/main.yml
Normal file
56
roles/minecraft-paper/tasks/main.yml
Normal file
@ -0,0 +1,56 @@
|
||||
#!/usr/bin/ansible-playbook
|
||||
# vim:ft=ansible:
|
||||
---
|
||||
- name: Set up Paper server
|
||||
block:
|
||||
- name: Set up system
|
||||
block:
|
||||
- name: Install required packages
|
||||
apt:
|
||||
name:
|
||||
- openjdk-8-jre
|
||||
- screen
|
||||
- name: Assure server user
|
||||
user:
|
||||
name: minecraft-paper
|
||||
system: yes
|
||||
home: "{{ paper_home }}"
|
||||
- name: Assure var directory
|
||||
file:
|
||||
path: "{{ paper_home }}"
|
||||
state: directory
|
||||
owner: minecraft-paper
|
||||
group: minecraft-paper
|
||||
# Sticky, SetGID
|
||||
mode: "3775"
|
||||
- name: Assure systemd unit
|
||||
template:
|
||||
src: "paper@.service"
|
||||
dest: /etc/systemd/system/paper@.service
|
||||
notify: "restart paper {{ paper_name }}"
|
||||
- name: Set up server "{{ paper_name }}"
|
||||
block:
|
||||
- name: Assure server directory
|
||||
file:
|
||||
path: "{{ paper_home }}/{{ paper_name }}"
|
||||
state: directory
|
||||
owner: minecraft-paper
|
||||
group: minecraft-paper
|
||||
- name: Configure server.properties
|
||||
template: src=server.properties dest="{{ paper_home }}/{{ paper_name }}/server.properties"
|
||||
notify: "restart paper {{ paper_name }}"
|
||||
- name: Accept EULA
|
||||
template: src=eula.txt dest="{{ paper_home }}/{{ paper_name }}/eula.txt"
|
||||
- name: Download Paper
|
||||
get_url: url="{{ paper_downloadurl }}" dest="{{ paper_home }}/{{ paper_name }}/server.jar"
|
||||
notify: "restart paper {{ paper_name }}"
|
||||
become: yes
|
||||
become_user: minecraft-paper
|
||||
- name: Enable service
|
||||
systemd: name="paper@{{ paper_name }}" enabled=yes state=started
|
||||
- name: Template out backup module
|
||||
template:
|
||||
src: backup.sh
|
||||
dest: "/opt/backups/modules/paper-{{ paper_name }}.sh"
|
||||
mode: "0600"
|
||||
become: yes
|
28
roles/minecraft-paper/templates/backup.sh
Normal file
28
roles/minecraft-paper/templates/backup.sh
Normal file
@ -0,0 +1,28 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# paper-{{ paper_name }}.sh
|
||||
# Backup script for Minecraft. Meant to be sourced by our main backup script
|
||||
# Copyright (C) 2020 Vintage Salt <rehashedsalt@cock.li>
|
||||
#
|
||||
# Distributed under terms of the MIT license.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
export OUTDIR="$BACKUPSDIR/{{ paper_name }}"
|
||||
|
||||
# Sanity checks
|
||||
if [ -z "$BACKUPSDIR" ]; then
|
||||
log "BACKUPSDIR was undefined. Run the main backup script instead of this one."
|
||||
return 1
|
||||
fi
|
||||
if ! [ -d "$OUTDIR" ]; then
|
||||
if ! mkdir "$OUTDIR"; then
|
||||
log "Unable to find or create output directory: $OUTDIR"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# WE MAKE BACKUP NOW SERGEI
|
||||
tar czf "$OUTDIR/{{ paper_name }}-$(date -Iseconds)-full.tar.gz" "{{ paper_home }}/{{ paper_name }}/"
|
||||
|
2
roles/minecraft-paper/templates/eula.txt
Normal file
2
roles/minecraft-paper/templates/eula.txt
Normal file
@ -0,0 +1,2 @@
|
||||
# Tacos best food yadda yadda
|
||||
eula=true
|
39
roles/minecraft-paper/templates/paper@.service
Normal file
39
roles/minecraft-paper/templates/paper@.service
Normal file
@ -0,0 +1,39 @@
|
||||
#
|
||||
# Licensed under the terms of the MIT license
|
||||
# Source: https://github.com/agowa338/MinecraftSystemdUnit/
|
||||
# vim:ft=dosini:
|
||||
#
|
||||
|
||||
[Unit]
|
||||
Description=Paper Minecraft Server %i
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=minecraft
|
||||
Group=mc-admin
|
||||
WorkingDirectory={{ paper_home }}/%i
|
||||
PrivateUsers=true
|
||||
ProtectSystem=full
|
||||
ProtectHome=true
|
||||
# Implies MountFlags=slave
|
||||
ProtectKernelTunables=true
|
||||
# Implies NoNewPrivileges=yes
|
||||
ProtectKernelModules=true
|
||||
# Implies MountAPIVFS=yes
|
||||
ProtectControlGroups=true
|
||||
|
||||
ExecStart=/bin/sh -c '/usr/bin/screen -DmS %i /usr/bin/java -Xms{{ paper_jre_xms }} -Xmx{{ paper_jre_xmx }} -jar server.jar nogui'
|
||||
|
||||
ExecReload=/usr/bin/screen -p 0 -S %i -X eval 'stuff "reload"\\015'
|
||||
|
||||
ExecStop=/usr/bin/screen -p 0 -S %i -X eval 'stuff "say {{ paper_stopmessage }}"\\015'
|
||||
ExecStop=/usr/bin/screen -p 0 -S %i -X eval 'stuff "save-all"\\015'
|
||||
ExecStop=/usr/bin/screen -p 0 -S %i -X eval 'stuff "stop"\\015'
|
||||
ExecStop=/bin/sleep 5
|
||||
|
||||
Restart=always
|
||||
# Restart after 24hrs
|
||||
RuntimeMaxSecs=86400
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
38
roles/minecraft-paper/templates/server.properties
Normal file
38
roles/minecraft-paper/templates/server.properties
Normal file
@ -0,0 +1,38 @@
|
||||
# Minecraft server properties
|
||||
allow-flight=true
|
||||
allow-nether=true
|
||||
difficulty={{ paper_mc_difficulty }}
|
||||
enable-command-block=true
|
||||
enable-query=false
|
||||
enable-rcon=false
|
||||
force-gamemode=false
|
||||
gamemode={{ paper_mc_gamemode }}
|
||||
generate-structures=true
|
||||
generator-settings={{ paper_mc_gensettings }}
|
||||
hardcore=false
|
||||
level-name=world
|
||||
level-seed=
|
||||
level-type={{ paper_mc_leveltype }}
|
||||
max-build-height=256
|
||||
max-players={{ paper_mc_maxplayers }}
|
||||
max-tick-time=60000
|
||||
max-world-size=29999984
|
||||
motd={{ paper_mc_motd }}
|
||||
network-compression-threshold=256
|
||||
online-mode=true
|
||||
op-permission-level=4
|
||||
player-idle-timeout=0
|
||||
prevent-proxy-connections=false
|
||||
pvp={{ paper_mc_pvp }}
|
||||
resource-pack=
|
||||
resource-pack-sha1=
|
||||
server-ip=
|
||||
server-port={{ paper_port }}
|
||||
snooper-enabled=false
|
||||
spawn-animals=true
|
||||
spawn-monsters=true
|
||||
spawn-npcs=true
|
||||
spawn-protection={{ paper_mc_spawnprotection }}
|
||||
use-native-transport=true
|
||||
view-distance={{ paper_mc_viewdist }}
|
||||
white-list={{ paper_mc_whitelist }}
|
Loading…
Reference in New Issue
Block a user