-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement description attribute for network interface
- Loading branch information
1 parent
5144802
commit a51f20e
Showing
3 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
# @param endpoint fqdn:port or ip:port where we connect to | ||
# @param addresses different addresses for the systemd-networkd configuration | ||
# @param persistent_keepalive is set to 1 or greater, that's the interval in seconds wireguard sends a keepalive to the other peer(s). Useful if the sender is behind a NAT gateway or has a dynamic ip address | ||
# @param description an optional string that will be added to the wireguard network interface | ||
# | ||
# @author Tim Meusel <[email protected]> | ||
# | ||
|
@@ -51,6 +52,7 @@ | |
Boolean $manage_firewall = true, | ||
Array[Stdlib::IP::Address] $source_addresses = [], | ||
Array[Hash[String,Variant[Stdlib::IP::Address::V4::CIDR,Stdlib::IP::Address::V6::CIDR]]] $addresses = [], | ||
Optional[String[1]] $description = undef, | ||
) { | ||
require wireguard | ||
|
@@ -92,12 +94,15 @@ | |
} | ||
# lint:ignore:strict_indent | ||
$netdev_config = @(EOT) | ||
<%- | $interface, $dport, $public_key, $endpoint | -%> | ||
<%- | $interface, $dport, $public_key, $endpoint, $description | -%> | ||
# THIS FILE IS MANAGED BY PUPPET | ||
# based on https://dn42.dev/howto/wireguard | ||
[NetDev] | ||
Name=<%= $interface %> | ||
Kind=wireguard | ||
<% if $description { -%> | ||
Description=<%= $description %> | ||
<%} -%> | ||
[WireGuard] | ||
PrivateKeyFile=/etc/wireguard/<%= $interface %> | ||
|
@@ -114,7 +119,7 @@ | |
AllowedIPs=0.0.0.0/0 | ||
| EOT | ||
systemd::network { "${interface}.netdev": | ||
content => inline_epp($netdev_config, { 'interface' => $interface, 'dport' => $dport, 'public_key' => $public_key, 'endpoint' => $endpoint }), | ||
content => inline_epp($netdev_config, { 'interface' => $interface, 'dport' => $dport, 'public_key' => $public_key, 'endpoint' => $endpoint, 'description' => $description }), | ||
restart_service => true, | ||
owner => 'root', | ||
group => 'systemd-network', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters