-
Notifications
You must be signed in to change notification settings - Fork 1
0. 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.
- 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 usebecome
in your playbook.
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
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.
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
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
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.