ansible/roles/minecraft-paper/tasks/main.yml
Salt abb8090c9b Add new host and enroll it in Paper
Note: currently untested, hopefully shit Just Werks
2020-10-10 22:44:17 -05:00

57 lines
1.9 KiB
YAML

#!/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