This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
2. Advanced Usage
Jose R. Gonzalez edited this page May 8, 2018
·
1 revision
The terraria_server
role is intended to be versatile, allowing the configuration of a single instance with minimal effort as well as multiple instances across multiple hosts. Below are examples of consuming the role to fit varied use cases
The following playbook uses the host_vars/
directory to define the deployment. In this particular example, we assume most other default variables that are not being configured are to be consume - whether the only variation lies in the terraria_version
, world_name
, and server_port
variables.
---
- hosts: servers
tasks:
- include_role:
name: terraria_server
vars:
terraria_version: "{{ worldconfig.terraria_version }}"
world_name: "{{ worldconfig.world_name }}"
server_port: "{{ worldconfig.server_port }}"
with_items: "{{ hostvars[inventory_hostname].worlds }}"
loop_control:
loop_var: worldconfig
The complementary host variables applicable to any given host in the inventory.
---
worlds:
- world_name: "WorldOne"
terraria_version: 1353
server_port: 7777
- world_name: "WorldTwo"
terraria_version: 1353
server_port: 7778