kpfleming.systemd_networkd.wireguard role – Manages systemd-networkd WireGuard tunnel virtual network devices.
Note
This role is part of the kpfleming.systemd_networkd collection (version 25.9.0).
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it use: ansible-galaxy collection install kpfleming.systemd_networkd.
To use it in a playbook, specify: kpfleming.systemd_networkd.wireguard.
Entry point main – Manages systemd-networkd WireGuard tunnel virtual network devices.
Synopsis
- This role will create (or update) three items in /etc/systemd/network for each specified tunnel: 1) A drop-in directory for the underlying network 2) A .netdev file for the tunnel device 3) A .conf file in the drop-in directory connecting the tunnel device to the underlying network 
- Detailed descriptions of parameters and their behavior can be found in ‘man systemd.netdev’. 
- Sets fact named ‘systemd_networkd_wireguard_changed’ to either true or false to indicate whether any changes were made. 
Parameters
| Parameter | Comments | 
|---|---|
| Suppress the reloading of systemd-networkd if changes are made. Choices: 
 | |
| Suppress the restarting of systemd-networkd if changes are made to the netdev configuration. Choices: 
 | |
| Root path of filesystem containing systemd-networkd configuration files. Default:  | |
| Attributes of the interfaces to be managed. | |
| Matching attributes of the network device. | |
| System-specific attributes to be matched. | |
| Match system architecture. | |
| Match service credential. | |
| Match system firmware. | |
| Match hostname or machine ID. | |
| Match kernel command line option presence. | |
| Match kernel version expression. | |
| Match virtualization type. | |
| Name of the WireGuard device. | |
| Attributes of the WireGuard network device. | |
| MAC address to use on the device. | |
| The MTU for the device. | |
| Attributes of the peers for the tunnel. | |
| Addresses, with optional netmasks, which the peer is allowed to use for sending traffic, and for which traffic will be sent to the peer. | |
| Initial address and port to be used for traffic to this peer. | |
| Name of the peer (will only be used as a comment in the configuration file). | |
| Interval, in seconds, to send empty-but-authenticated packets to this peer. | |
| Base64-encoded preshared key with the peer. | |
| Path to file containing a base64-encoded preshared key with the peer. | |
| Base64-encoded public key of the peer. | |
| Metric value for routes added when route_table is specified. Overrides the setting from the tunnel, if specified. | |
| Route table name (from networkd.conf), number, or predefined name (“default”, “main”, or “local”). Overrides the setting from the tunnel, if specified. | |
| Attributes of the WireGuard device. | |
| Mark to be set on outgoing packets from this interface. | |
| UDP port to listen for incoming traffic. If not specified, a port will be chosen based on the interface name. | |
| Base64-encoded private key. | |
| Path to file containing a base64-encoded private key. | |
| Metric value for routes added when route_table is specified. | |
| Route table name (from networkd.conf), number, or predefined name (“default”, “main”, or “local”). | 
