Skip to content

Commit

Permalink
Add some comments to wgquick config file
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianrakel committed Aug 8, 2022
1 parent 7bc81b7 commit b77ddb8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
22 changes: 11 additions & 11 deletions manifests/interface.pp
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,21 @@
case $provider {
'systemd': {
wireguard::provider::systemd { $interface :
interface => $interface,
peers => $peers + $peer,
dport => $dport,
addresses => $addresses,
description => $description,
mtu => $mtu,
routes => $routes,
interface => $interface,
peers => $peers + $peer,
dport => $dport,
addresses => $addresses,
description => $description,
mtu => $mtu,
routes => $routes,
}
}
'wgquick': {
wireguard::provider::wgquick { $interface :
interface => $interface,
peers => $peers + $peer,
dport => $dport,
addresses => $addresses,
interface => $interface,
peers => $peers + $peer,
dport => $dport,
addresses => $addresses,
}
}
default: {
Expand Down
12 changes: 5 additions & 7 deletions manifests/provider/systemd.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@
Optional[String[1]] $description = undef,
Optional[Integer[1280, 9000]] $mtu = undef,
Array[Hash[String[1], Variant[String[1], Boolean]]] $routes = [],
Optional[String[1]] $preshared_key = undef,
) {
assert_private()
systemd::network { "${interface}.netdev":
content => epp("${module_name}/netdev.epp", {
'interface' => $interface,
'dport' => $dport,
'description' => $description,
'mtu' => $mtu,
'peers' => $peers,
'preshared_key' => $preshared_key,
'interface' => $interface,
'dport' => $dport,
'description' => $description,
'mtu' => $mtu,
'peers' => $peers,
}),
restart_service => true,
owner => 'root',
Expand Down
10 changes: 4 additions & 6 deletions manifests/provider/wgquick.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
Wireguard::Peers $peers = [],
Integer[1024, 65000] $dport = Integer(regsubst($title, '^\D+(\d+)$', '\1')),
Array[Hash[String,Variant[Stdlib::IP::Address::V4::CIDR,Stdlib::IP::Address::V6::CIDR]]] $addresses = [],
Optional[String[1]] $preshared_key = undef,
) {
assert_private()
$params = {
'interface' => $interface,
'dport' => $dport,
'peers' => $peers,
'addresses' => $addresses,
'preshared_key' => $preshared_key,
'interface' => $interface,
'dport' => $dport,
'peers' => $peers,
'addresses' => $addresses,
}
file { "/etc/wireguard/${interface}.conf":
Expand Down
4 changes: 4 additions & 0 deletions templates/wireguard_conf.epp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Array[Hash] $addresses,
Optional[String[1]] $preshared_key,
| -%>
# THIS FILE IS MANAGED BY PUPPET
[Interface]
<% $addresses.each |$address| { -%>
Address = <%= $address['Address'] %>
Expand All @@ -13,6 +14,9 @@ ListenPort = <%= $dport %>
PostUp = wg set %i private-key /etc/wireguard/<%= $interface %>
<% $peers.each |$peer| { -%>

<% if $peer['description'] { -%>
# <%= $peer['description'] %>
<% } -%>
[Peer]
PublicKey=<%= $peer['public_key'] %>
<% if $peer['endpoint'] { -%>
Expand Down

0 comments on commit b77ddb8

Please sign in to comment.