Code Monkey home page Code Monkey logo

ansible-lgsm-l4d-l4d2's Introduction

ansible-lgsm-l4d-l4d2

⚠️ You need to have some experience with Ansible and left4dead games before using this repo !

Example of a basic ansible configuration

1/ On the ansible controller (tested on Debian 12)

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

2/ On each ansible nodes

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

3/ On the ansible controller

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}

Configuration and installation

1/ Configure files of left4dead1 and/or left4dead2

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 :

    In role/lgsminstallation/files/l4d[2]server/lgsm_cfg

    put file like l4dserver.cfg

    In role/lgsminstallation/files/l4d[2]server/server

    put file like host.txt or mymotd.txt

    In role/lgsminstallation/files/l4d[2]server/server_cfg

    put file like server.cfg, l4dserver.cfg

    In role/maps/files/l4d[2]server/maps

    put maps not on the steam workshops

    In role/maps/files/l4d2server/maps/workshops

    put workshops maps in workshops folder for l4d2 only

    In role/metamod/files/l4d[2]server/metamod_plugins

    put files in metamod folder

    In role/sourcemod/files/l4d[2]server/sourcemod_plugins

    put files in addons and cfg/sourcemod folders

    In role/strippersource/files/l4d[2]server/stripper_cfg

    put cfg maps in dumps and maps folders

2/ Installation of left4dead1 and/or left4dead2 dedicated servers

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

About

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://docs.linuxgsm.com/

https://linuxgsm.com/servers/l4dserver/

https://linuxgsm.com/servers/l4d2server/

Ansible :

https://www.ansible.com/

ansible-lgsm-l4d-l4d2's People

Contributors

fbapt avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.