⚠️ You need to have some experience with Ansible and left4dead games before using this repo !
As root user :
Create a user ansible :
controlleruser=ansible
adduser "${controlleruser}"
Install requirements packages :
apt-get install sudo openssh-server openssh-client whois python3 python3-apt python3-venv python3-full git
Add NOPASSWD sudo :
echo "${controlleruser} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/"${controlleruser}"
Install ansible package with python3 environnement as ansible user :
su - "${controlleruser}"
python3 -m venv venv
echo "source ~/venv/bin/activate" | tee -a ~/.profile
source ~/venv/bin/activate
pip install pip --upgrade
pip install ansible ansible-core ansible-lint
Generate a ssh key as ansible user :
ssh-keygen -o -a 256 -t ed25519 -C "${USER}@${HOSTNAME}" -f ~/.ssh/id_ed25519_ansible -N ""
Download private key id_ed25519_ansible to Windows Linux etc... https://kb.iu.edu/d/aews
Download repository
git clone https://github.com/fbapt/ansible-lgsm-l4d-l4d2.git
As root user :
Create a user ansible :
nodeuser=ansible
adduser "${nodeuser}
Install requirements package :
apt-get install sudo openssh-server python3 python3-apt
Add NOPASSWD sudo :
echo "${nodeuser} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/"${nodeuser}"
Save ip of each ansible nodes :
ip a
As ansible user, copy ssh key with user and ip of each ansible nodes :
nodeip=x.x.x.x
nodeuser=ansible
ssh-copy-id -i ~/.ssh/id_ed25519_ansible.pub ${nodeuser}@${nodeip}
If you are on vscode add this to your c:/Users/USER/AppData/Roaming/Code/User/settings.json
..........,
"terminal.integrated.shellArgs.linux": ["-l"],
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash",
"icon": "terminal-bash",
"args": [ "-l" ]
},
}
Edit files :
-
inventory/lgsmhosts.yml
-
host_vars/production/production.yml (important: ssh public key for users)
-
host_vars/production/vault.yml
-
.vault_pass
-
Add l4d1/2 configuration files in each roles if variables in host_vars/production/production.yml are on true, examples :
put file like l4dserver.cfg
put file like host.txt or mymotd.txt
put file like server.cfg, l4dserver.cfg
put maps not on the steam workshops
put workshops maps in workshops folder for l4d2 only
put files in metamod folder
put files in addons and cfg/sourcemod folders
put cfg maps in dumps and maps folders
On the ansible controller, as ansible user run playbooks on a Debian 11 or 12:
If you have a password with the playbooks --> option -k
Install left4dead1 and/or left4dead2 dedicated servers :
ansible-playbook --limit production system_update.yml
ansible-playbook --limit production lgsm.yml
(optional) configure firewall with a harden ssh :
⚠️ If you use 'configure_ssh_authenticationmethods: publickey' --> You need to create each user ssh key on your linux server and download on your computer before executing this playbook ! use a sofware such as pageant (putty)...
Accepted hostkey rsa minimun 3072 and ed25519, ssh is restricted to IPV4
ansible-playbook --limit production configure_ssh_iptables.yml
(optional) improve performance of the server :
ansible-playbook --limit production performance.yml
Playbooks have been tested with packages of ansible (9.4.0), ansible-core (2.16.5) and ansible-lint (24.2.2).
Tested on Debian 11 and 12
Documentation of lgsm :
https://linuxgsm.com/servers/l4dserver/
https://linuxgsm.com/servers/l4d2server/
Ansible :