Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

0. Getting Started

Jose R. Gonzalez edited this page May 9, 2018 · 4 revisions

Getting Started

Here we'll set up a single instance of Terraria running on a single server. We'll use an extension of the minimal playbook in the role README.md.

Assumptions

  • Ansible is configured and the following command runs successfully against your host list under inventory group [servers]
ansible -m ping servers
  • Your connection to your remote host is through root or a user with inherent administrative privileges. If this is not the case, you may need to use become in your playbook.

Prepare the Inventory

For a single host, your inventory may look like the following - adjust the IP address for your needs (and note that we're specifying the user root per the assumptions listed above).

[servers]
192.168.10.10 ansible_user=root

Building a Variables File

There are additional server variables that can be configured, but most single-instance deployments for private/personal use will be looking to configure the following variables. Create a file with the following keys, and adjust the values to fit your needs.

For a full list of variables and their options (where relevant), please review the documentation.

---
world_name: "ServerNameGoesHere"
world_motd: "ServerMOTDGoesHere"
world_difficulty: "normal"
world_size: "medium"
world_max_players: 5
server_lang: "en-US"
banned_players:
  - PlAcEhOlDeRl337
world_autocreate: True
server_port: 7777
server_password: "ARANDOMPASSWORDHERE1"

NOTE -- the banned_players list has a placeholder user in place by default. If no users are specified, this will be configured as such.

Prepare the playbook

Create a playbook file with the minimum required variable, terraria_version, defined - the latest as of this writing being 1353.

---
- hosts: servers
  roles:
  - role: terraria_server
    terraria_version: 1353

Execute the deployment

With everything in place, run the playbook (we've referenced the names of these files - substitute what applies to you):

ansible-playbook -i inventoryfile -e '@vars.yml' playbook.yml

Interact with your deployment

SSH to your target host. By default, the user terraria is configured as the host-level management user for this server. This user is deployed with /bin/false as the default shell, and no password is configured - preventing access to this user remotely.

As the root user, you can access this user in the following way:

su - terraria -s /bin/bash

This should drop you into the terraria user's shell. You can confirm the state of the server by checking your available screen sessions:

screen -ls

As you have accessed this user using su, you will not be able to attach to the screen due to the absence of tty. We can work around this, and then attach to the screen:

script /dev/null
screen -x

Note that at this point you should be the Terraria server's shell to run commands as you see fit.

To detach, use screen detach commands which by default should be Ctrl-A, d. You can exit the session safely.

Clone this wiki locally