Automate 7 Days to Die Game Server Deployment with Ansible

7days_icon7 Days to Die is an extremely fun apocalyptic zombie survival crafting game with much less emphasis on the crafting and more on survival.  It’s a cross between the good building aspects of Minecraft, with the bleak realism of Rust or DayZ and early character progression of Everquest classic.  It runs natively in Linux, Mac or Windows.  Here I’ll show you how to automate deploying a gameserver using Ansible.

What does it do?

  • Automate deployment of 7 Days to Die Server
    • Creates a 7days user with /bin/nologin shell for running the game server
    • Installs game dependencies
    • Downloads and sets up SteamCMD
    • Drops in templated server configs, startup script
    • Installs /enables 7 Days to Die Systemd services for management

Requirements

  • RHEL7, CentOS, or Fedora for your server
  • Ansible installed on the machine where you run Ansible commands
    • Fedora23 server needs a few packages until Ansible supports Python3
ansible fedora-server-01 -u root -m shell -i hosts -a "dnf install yum python2 libsemanage-python python2-dnf -y"

7 Days Server Deployment Instructions
Clone repo and setup your hosts file, substitute for your target gameserver host.

git clone https://github.com/sadsfae/ansible-7days
cd ansible-7days
sed -i 's/host-01/7daystodieserver/' hosts

Optional: edit any other variables like server_name or ports used by the game:

vi install/group_vars/all.yml

Run the playbook

ansible-playbook -i hosts install/7days.xml

You should now have a working 7Days to Die server on udp/26900 unless you changed it.

On subsequent runs Ansible will simply update SteamCMD, 7 days assets and restart the 7days systemd service.

To Do
Add optional ability to import saved games
Flesh out firewall rules more to include ranges
Expand server config variables

Live Action Trailer
I came across this video from Steam – it’s a live action trailer for 7 days to die, pretty amusing and quite accurate so far as what to expect.

About Will Foster

hobo devop/sysadmin/SRE
This entry was posted in gaming, open source, sysadmin and tagged , , , , , . Bookmark the permalink.

1 Response to Automate 7 Days to Die Game Server Deployment with Ansible

  1. Alex Booth says:

    Thanks for the 7DTD Ansible guide its major helpful. Where would we be without GitHub!

    Like

Have a Squat, Leave a Reply ..

This site uses Akismet to reduce spam. Learn how your comment data is processed.