Wireguard mesh network with Ansible
Find a file
2025-11-16 16:55:00 +01:00
group_vars initial commit 2025-11-16 16:55:00 +01:00
.gitignore initial commit 2025-11-16 16:55:00 +01:00
ansible.cfg initial commit 2025-11-16 16:55:00 +01:00
inventory.yaml initial commit 2025-11-16 16:55:00 +01:00
playbook.yaml initial commit 2025-11-16 16:55:00 +01:00
README.md initial commit 2025-11-16 16:55:00 +01:00
requirements.txt initial commit 2025-11-16 16:55:00 +01:00
wg-extra-peer.conf.j2 initial commit 2025-11-16 16:55:00 +01:00

wg-mesh

This playbook can create a Wireguard mesh network to connect multiple servers with P2P way.

Vars

An example inventory.yaml is attached. Here you can configure the servers and subnets. In group_vars/all.yaml you can configure clients. These connect to servers P2P but not to each other. This needed to let to access the entire infra on my laptop over VPN.

Usage

After this repo cloned I suggest to use Python venv. Install python3-venv on Debian or use other commands to install venv. Run the following.

python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
ansible-playbook playbook.yaml -K

Type the become password and process will start. On every server wg-mesh will be configured and in output folder you can use the client configs. Do not forget to generate private key and public key for the clients before playbook run.