Add a bunch of dysfunctional crap
This commit is contained in:
parent
661bc4e4e1
commit
c3ca975e85
3
README.md
Normal file
3
README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# ansible-role-terraria
|
||||
|
||||
A role to install a Terraria server.
|
17
defaults/main.yml
Normal file
17
defaults/main.yml
Normal file
@ -0,0 +1,17 @@
|
||||
# vim:ft=ansible:
|
||||
terraria_name: default
|
||||
terraria_version: blah
|
||||
terraria_enabled: yes
|
||||
terraria_restart_delay: 5
|
||||
|
||||
# Packages
|
||||
# Put any extra dependencies (for mods, etc.) in _extra
|
||||
terraria_packages:
|
||||
- mono-complete
|
||||
terraria_packages_extra: []
|
||||
|
||||
# Server configuration
|
||||
#terraria_downloadurl:
|
||||
|
||||
# Service configuration
|
||||
terraria_home: /opt/terraria
|
20
tasks/main.yml
Normal file
20
tasks/main.yml
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env ansible-playbook
|
||||
# vim:ft=ansible:
|
||||
---
|
||||
- name: set up system
|
||||
block:
|
||||
- name: install required packages
|
||||
apt: name="{{ terraria_packages + terraria_packages_extra }}"
|
||||
- name: assure server user
|
||||
user: name=terraria system=yes home={{ terraria_home }}
|
||||
- name: assure operational directory
|
||||
file: path={{ terraria_home }} state=directory owner=terraria group=terraria mode="3775"
|
||||
- name: assure systemd unit
|
||||
template: src=terraria@.service dest=/etc/systemd/system/terraria@.service
|
||||
notify: "restart terraria {{ terraria_name }}"
|
||||
- name: set up terraria
|
||||
block:
|
||||
- name: assure server directory
|
||||
file: path={{ terraria_home }}/{{ terraria_name }} state=directory
|
||||
become: yes
|
||||
become_user: terraria
|
36
templates/terraria@.service
Normal file
36
templates/terraria@.service
Normal file
@ -0,0 +1,36 @@
|
||||
#
|
||||
# Licensed under the terms of the MIT license
|
||||
# vim:ft=dosini:
|
||||
#
|
||||
|
||||
[Unit]
|
||||
Description=Terraria Server %i
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=terraria
|
||||
Group=terraria
|
||||
WorkingDirectory={{ terraria_home }}/%i
|
||||
EnvironmentFile={{ terraria_home }}/%i/env
|
||||
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${JRE_XMS} -Xmx${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 Server is going down: Service was stopped"\\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'
|
||||
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user