This documentation provides a high-level overview of setting up a Project Zomboid dedicated server using Terraform for VM provisioning and Ansible for server configuration.
- Overview
- Project Structure
- Key Configuration Points
- Deployment Steps
- Playit.gg Tunnel Setup
- Troubleshooting
This project automates the deployment of a Project Zomboid server on a Proxmox Virtual Environment (PVE). It includes:
- Terraform: Provisions the virtual machine.
- Ansible: Configures the server, including SSH, firewall, and server-specific settings.
- Playit.gg Tunnel: Exposes the server to the internet using a secure tunnel.
Here is an overview of the project directory:
project-zomboid/
│
│ # Ansible
├── site.yml # Main Ansible playbook
├── bootstrap.yml # Playbook for initial setup
├── requirements.yml # Ansible role dependencies
├── group_vars/
│ ├── all.yml # General variables
│ └── vault.yml # Encrypted sensitive variables
│
├── roles/
│ ├── ssh/ # SSH configuration role
│ ├── firewall/ # Firewall setup role
│ ├── playit/ # Playit agent setup role
│ ├── node_exporter/ # Monitoring setup role
│ └── server/ # Server configuration role
│ ├── defaults/
│ └── main.yml # Configure mods and global server settings
│
│ # Terraform
├── main.tf # Proxmox resource definitions
├── pool.tf # Proxmox pool settings
├── vms.tf # Virtual machine configuration
├── variables.tf # Terraform variable definitions
├── terraform.tfvars # User-specific variable values
├── credentials.auto.tfvars # Sensitive credentials (git-ignored)
└── README.md # Documentation
terraform.tfvars
: Define VM properties such as IP address, memory, and CPU.credentials.auto.tfvars
: Store sensitive Proxmox API credentials securely.
group_vars/all.yml
: Contains general variables likenew_admin_user
.group_vars/vault.yml
: Encrypted sensitive variables, including:server_password
: The Project Zomboid server password.
bootstrap.yml
: Sets up SSH and firewall.site.yml
: Configures the server and Playit tunnel.roles/server/defaults/main.yml
: Allows adding/removing mods and updating global server's settings.
-
Initialize Terraform:
terraform init
-
Apply the configuration:
terraform apply
-
Run the bootstrap playbook:
ansible-playbook bootstrap.yml -i inventories/main/hosts
-
Configure the server:
ansible-playbook site.yml -i inventories/main/hosts
Playit.gg allows you to expose your server to the internet without requiring port forwarding. Here’s how to set it up:
Executing the site.yml
playbook will automatically install the Playit agent and setup the service. The service will be restarted once the next parts are done.
-
Run the Playit agent on your server:
sudo -u playit /usr/local/bin/playit
-
Follow the instructions to link your machine with your Playit.gg account. Once linked, you'll have an auto-generated configuration file set up in
~/.config/playit/
. -
Use the Playit dashboard to create a tunnel:
- Go to
All Agents
and select your agent. - Select
Add Tunnel
. - Choose
UDP
protocol. - Enter the port number your Project Zomboid server uses (default: 16261).
- Assign a subdomain or custom domain to your tunnel.
- Go to
- Verify API credentials and Proxmox connectivity.
- Ensure the vault file is encrypted and the password is correct.
- Ensure the Zomboid service is running:
sudo systemctl status zomboid
- Check logs for errors:
sudo journalctl -u zomboid
- Ensure the Playit agent is running:
sudo systemctl status playit
- Check logs for errors:
sudo journalctl -u playit