saltyorg / Sandbox

Saltbox Sandbox
GNU General Public License v3.0
73 stars 101 forks source link

feat(role): LinuxGameServerManager #321

Closed DevScarabyte closed 10 months ago

DevScarabyte commented 10 months ago

Description

Role to install game servers using docker-gameserver to manage the servers. It depends on using the multi-instance configuration to set the correct image, directory, ports, and any other settings.

The lgsm instance will be ignored since it will throw errors saying there is no such docker image.

How Has This Been Tested?

These are the instances i used to test in my inventory config

lgsm_instances: ["lgsm","lgsm_valheim", "lgsm_rust"]
# Example setting image version to correct shortcode from https://github.com/GameServerManagers/LinuxGSM/blob/master/lgsm/data/serverlist.csv
lgsm_valheim_docker_image_tag: "vh"
lgsm_valheim_docker_ports_defaults: ["2456:2456/udp","2457:2457/udp"]
lgsm_rust_docker_ports_defaults: ["28015:28015/udp","28017:28017/udp","28082:28082/udp"]

The configs for servers are in /opt/CONTAINERNAME/config-lgsm/LGSMSERVERNAME/ For example my valheim config would be /opt/lgsm_valheim/config-lgsm/vhserver/vhserver.cfg which is the lgsm instance config for that server.

/opt/lgsm_valheim/config-lgsm/vhserver/common.cfg works too. Can read more here

owine commented 10 months ago
jinja[spacing]: Jinja2 spacing could be improved: {{ lgsm_name | replace('lgsm_','') }} -> {{ lgsm_name | replace('lgsm_', '') }} (warning)
roles/lgsm/defaults/main.yml:50 Jinja2 template rewrite recommendation: `{{ lgsm_name | replace('lgsm_', '') }}`.

yaml[trailing-spaces]: Trailing spaces
roles/lgsm/tasks/main.yml:32