No description
- Python 74.4%
- Jinja 25.6%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| defaults | ||
| handlers | ||
| meta | ||
| molecule/default | ||
| tasks | ||
| templates | ||
| .gitignore | ||
| .yamllint | ||
| CHANGELOG.md | ||
| LICENSE | ||
| README.md | ||
Ansible role: Wireguard
Install and configure Wireguard
Requirements
- Ansible >= 2.21
- Debian
- Trixie
Role variables
| Name | Type | Required | Default | Comment |
|---|---|---|---|---|
| wireguard_interfaces | dict | no | VPN interfaces with config |
wireguard_interfaces
| Name | Type | Required | Default | Comment |
|---|---|---|---|---|
| key | str | yes | interface name | |
| config | dict | no | config file | |
| state | str | no | present | if absent, uninstall interface |
Example:
wg0:
config:
Interface:
PrivateKey: "4JyarRIBN4r91O8fnI0BnqH18w2+PViMd4EOHbteQk8="
Address: "192.168.100.10/24"
ListenPort: 52180
Peer:
- PublicKey: "JQ24pK+trIO74t1tHvMb/R81A7XBN7uu5g4XgRt1j0Y="
AllowedIPs: "192.168.100.11/32"
- PublicKey: "JQ24pK+trIO74t1tHvMb/R81A7XBN7uu5g4XgRt1j0Y="
AllowedIPs: "192.168.100.12/32"
wg1:
state: "absent"
How to use
- hosts: server
roles:
- nishiki.wireguard
vars:
wireguard_interfaces:
wg0:
config:
Interface:
PrivateKey: "4JyarRIBN4r91O8fnI0BnqH18w2+PViMd4EOHbteQk8="
Address: "192.168.100.10/24"
ListenPort: 52180
Peer:
- PublicKey: "JQ24pK+trIO74t1tHvMb/R81A7XBN7uu5g4XgRt1j0Y="
AllowedIPs: "192.168.100.11/32"
- PublicKey: "JQ24pK+trIO74t1tHvMb/R81A7XBN7uu5g4XgRt1j0Y="
AllowedIPs: "192.168.100.12/32"
wg1:
state: "absent"
Development
Test with molecule and docker
- install docker
- install
python3andpython3-pip - install molecule and dependencies
pip3 install molecule molecule-plugins ansible-lint pytest-testinfra yamllint - run
molecule test
License
Copyright (c) 2026 Adrien Waksberg
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.