56 lines
1.8 KiB
YAML
56 lines
1.8 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"
|
|
- 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
|