No description
  • Python 74.4%
  • Jinja 25.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Adrien Waksberg 8c2d90bb60
All checks were successful
/ lint (push) Successful in 11s
/ molecule (push) Successful in 1m18s
first version
2026-08-08 08:37:32 +02:00
.forgejo/workflows first version 2026-08-08 08:37:32 +02:00
defaults first version 2026-08-08 08:37:32 +02:00
handlers first version 2026-08-08 08:37:32 +02:00
meta first version 2026-08-08 08:37:32 +02:00
molecule/default first version 2026-08-08 08:37:32 +02:00
tasks first version 2026-08-08 08:37:32 +02:00
templates first version 2026-08-08 08:37:32 +02:00
.gitignore first version 2026-08-08 08:37:32 +02:00
.yamllint first version 2026-08-08 08:37:32 +02:00
CHANGELOG.md first version 2026-08-08 08:37:32 +02:00
LICENSE first version 2026-08-08 08:37:32 +02:00
README.md first version 2026-08-08 08:37:32 +02:00

Ansible role: Wireguard

Version License Build

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 python3 and python3-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.