Git Product home page Git Product logo

terraria_server's Introduction

Ansible Role: terraria_server

An ansible role to automate deployment of Terraria on linux hosts

Configures:

  • a service user
  • start scripts (executed in a screen session)
  • save scripts (executed every 30 minutes)
  • backups (rotated every 720 minutes by default)

Requirements


  • Linux target (this has been tested against Ubuntu 16.04 LTS)
  • Ansible version 2.4.2.0 (others may work, but this version was used for testing)

Role Variables

Minimum Required Variables

You must define the version to deploy as this will obtained from the server file mirror.

terraria_version: 1353

Common Variables

Check out the Getting Started page for Terraria server-specific variables for a common use case (single server, single instance)

All Variables

Documentation on all variables can be found in the wiki

Example Playbook

Calling the role with minimum required terraria_version and a few configured values, relying on defaults for everything else.

---
- hosts: servers
  roles:
  - role: terraria_server
    terraria_version: 1353
    world_name: "WorldOne"
    server_port: 7777

terraria_server's People

Contributors

komish avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

l30bola

terraria_server's Issues

Properly handles world names that contain spaces

Using a world name with spaces does not properly function.

Task Failure

TASK [terraria_server : Save and stop the server (if applicable)] ********************************************************************************************************
 [WARNING]: Consider using 'become', 'become_method', and 'become_user' rather than running su

fatal: [terraria.example.com]: FAILED! => {"changed": true, "cmd": ["su", "-", "terraria", "-s", "/bin/sh", "-c", "screen -S Ice Land7777 -p0 -X stuff \"exit^M\""], "delta": "0:00:00.017726", "end": "2018-05-07 04:18:46.741848", "msg": "non-zero return code", "rc": 1, "start": "2018-05-07 04:18:46.724122", "stderr": "", "stderr_lines": [], "stdout": "Must be connected to a terminal.", "stdout_lines": ["Must be connected to a terminal."]}
...ignoring

TASK [terraria_server : Allow time for server to save and cleanly exit] **************************************************************************************************
Pausing for 5 seconds
(ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort)
ok: [terraria.example.com]

TASK [terraria_server : Stop the existing screen session (if applicable)] ************************************************************************************************
fatal: [terraria.example.com]: FAILED! => {"changed": true, "cmd": ["su", "-", "terraria", "-s", "/bin/sh", "-c", "screen -S Ice Land7777 -p0 -X stuff \"exit^M\""], "delta": "0:00:00.018617", "end": "2018-05-07 04:18:53.003607", "msg": "non-zero return code", "rc": 1, "start": "2018-05-07 04:18:52.984990", "stderr": "", "stderr_lines": [], "stdout": "Must be connected to a terminal.", "stdout_lines": ["Must be connected to a terminal."]}
...ignoring

TASK [terraria_server : start the screen session] ************************************************************************************************************************
changed: [terraria.example.com]

TASK [terraria_server : start the server in the screen session] **********************************************************************************************************
fatal: [terraria.example.com]: FAILED! => {"changed": true, "cmd": ["su", "-", "terraria", "-s", "/bin/sh", "-c", "/opt/terraria/worlds/Ice Land/bin/start.sh"], "delta": "0:00:00.015358", "end": "2018-05-07 04:18:55.778558", "msg": "non-zero return code", "rc": 127, "start": "2018-05-07 04:18:55.763200", "stderr": "-su: 1: /opt/terraria/worlds/Ice: not found", "stderr_lines": ["-su: 1: /opt/terraria/worlds/Ice: not found"], "stdout": "", "stdout_lines": []}
	to retry, use: --limit @/Users/jose/Desktop/site.retry

PLAY RECAP ***************************************************************************************************************************************************************
terraria.example.com       : ok=26   changed=17   unreachable=0    failed=1

Config FIle

world=/opt/terraria/worlds/Ice Land/Ice Land.wld
autocreate=2
seed=ThisIsNotReallyASeed
worldname=Ice Land
difficulty=0
maxplayers=5
port=7777
motd=A new beginning...
worldpath=/opt/terraria/worlds/Ice Land
banlist=/opt/terraria/worlds/Ice Land/banlist.txt
secure=0
language=en-US
npcstream=60
priority=1

The server file doesn't exist, but as we've defined autocreate values so we should not get prompted at start up for manual input - but are definitely getting prompted:

$ bin/TerrariaServer.bin.x86_64 -config config.ini
Terraria Server v1.3.5.3

n	New World
d <number>Delete World

Optimize Role Execution

If deploying multiple worlds, currently the role will be executed against every world instance. It should be faster if we could deploy certain elements all at once (i.e. create directory structure for all worlds, render scripts for all worlds).

In addition, the way this is described under the Advanced Usage wiki page would break if world configurations were to differ as the playbook itself hardcodes which role variables are to be used for each instance in with_items.

ability to push a local world file

Currently there's no way to push a world file from a local backup or copy. In order to do this, you must deploy a new world, and then manually push your world file into place. This logic would be best if handled by the deployment step.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.