Add the wgvpn role for the BinaryLane VPN hosts
ci/woodpecker/pr/ruby-validate Pipeline was successful
ci/woodpecker/pr/bolt-validate Pipeline was successful
ci/woodpecker/pr/puppet-lint Pipeline was successful
ci/woodpecker/pr/yamllint Pipeline was successful
ci/woodpecker/pr/erb-validate Pipeline was successful
ci/woodpecker/pr/epp-validate Pipeline was successful
ci/woodpecker/pr/ruby-check Pipeline was successful
ci/woodpecker/pr/puppet-validate Pipeline was successful

This commit is contained in:
2026-10-16 23:40:35 +11:00
parent e6a06f4845
commit 27071d21ae
8 changed files with 134 additions and 0 deletions
@@ -0,0 +1,25 @@
---
networking_loopback0_ip: 198.18.2.162
networking_wg_link: 198.18.2.178/31
networking_vpc_iface: eth1
networking_vpc_cidr: 172.18.32.0/24
# wg0 p2p to prodnxsr0020; lab routes stay pinned to wg0 sourced from the /31 until ospf learns them
wireguard::interfaces:
wg0:
addresses:
- 198.18.2.179/31
listen_port: 51820
table: 'off'
post_up:
- ip route replace 198.18.0.0/16 dev wg0 src 198.18.2.179
- ip route replace 10.10.12.200/32 dev wg0 src 198.18.2.179
private_key: ''
peers:
- public_key: ''
endpoint: 103.216.191.185:51822
allowed_ips:
- 224.0.0.5/32
- 198.18.0.0/16
- 10.10.12.200/32
persistent_keepalive: 25
@@ -0,0 +1,25 @@
---
networking_loopback0_ip: 198.18.2.161
networking_wg_link: 198.18.2.176/31
networking_vpc_iface: eth1
networking_vpc_cidr: 172.18.30.0/24
# wg0 p2p to prodnxsr0020; lab routes stay pinned to wg0 sourced from the /31 until ospf learns them
wireguard::interfaces:
wg0:
addresses:
- 198.18.2.177/31
listen_port: 51820
table: 'off'
post_up:
- ip route replace 198.18.0.0/16 dev wg0 src 198.18.2.177
- ip route replace 10.10.12.200/32 dev wg0 src 198.18.2.177
private_key: ''
peers:
- public_key: ''
endpoint: 103.216.191.185:51821
allowed_ips:
- 224.0.0.5/32
- 198.18.0.0/16
- 10.10.12.200/32
persistent_keepalive: 25
+41
View File
@@ -0,0 +1,41 @@
---
hiera_include:
- wireguard
- frrouting
# no consul datacentre at the edge, so nothing to register or scrape via consul
profiles::consul::client::enable: false
exporters::node_exporter::enable: false
# ssh only from the lab over the vpn
ssh::server::options:
AllowUsers: '*@198.18.0.0/16 *@10.10.12.200/32'
# routing
sysctl::base::values:
net.ipv4.ip_forward:
value: '1'
# frrouting: p2p ospf over wg0; loopback /32, wg /31 and vpc /24 only, no default route in or out
frrouting::daemons:
ospfd: true
frrouting::ospfd_router_id: "%{hiera('networking_loopback0_ip')}"
frrouting::ospfd_interfaces:
wg0:
area: 0.0.0.0
network: point-to-point
dum0:
area: 0.0.0.0
passive: true
"%{hiera('networking_vpc_iface')}":
area: 0.0.0.0
passive: true
frrouting::ospfd_redistribute:
- connected
frrouting::ospfd_redistribute_connected_permit:
- "%{hiera('networking_loopback0_ip')}/32"
- "%{hiera('networking_wg_link')}"
- "%{hiera('networking_vpc_cidr')}"
frrouting::ospfd_deny_default_in: true
frrouting::ospf_preferred_source_enable: true
frrouting::ospf_preferred_source: "%{hiera('networking_loopback0_ip')}"
+2
View File
@@ -10,6 +10,8 @@ class frrouting (
Array[String] $ospfd_redistribute = [],
Array[String] $ospfd_networks = [],
Boolean $ospfd_default_originate_always = false,
Array[Stdlib::IP::Address::V4::CIDR] $ospfd_redistribute_connected_permit = [], # only these exact connected prefixes are redistributed
Boolean $ospfd_deny_default_in = false, # keep a learned default route out of the routing table
Boolean $mpls_te_enabled = false,
Optional[String] $mpls_ldp_router_id = undef,
Optional[String] $mpls_ldp_transport_addr = undef,
+21
View File
@@ -8,6 +8,9 @@ interface <%= iface %>
<% if params['area'] -%>
ip ospf area <%= params['area'] %>
<% end -%>
<% if params['network'] -%>
ip ospf network <%= params['network'] %>
<% end -%>
<% if params['passive'] == true -%>
ip ospf passive
<% end -%>
@@ -28,12 +31,27 @@ route-map CONNECTED-NON-K8S permit 100
exit
<% end -%>
<% if @ospfd_redistribute_connected_permit.any? -%>
<% @ospfd_redistribute_connected_permit.each_with_index do |prefix, i| -%>
ip prefix-list CONNECTED-PERMIT seq <%= (i + 1) * 5 %> permit <%= prefix %>
<% end -%>
route-map CONNECTED-PERMIT permit 10
match ip address prefix-list CONNECTED-PERMIT
exit
<% end -%>
<% if @ospfd_deny_default_in -%>
access-list NO-DEFAULT seq 5 deny 0.0.0.0/0 exact-match
access-list NO-DEFAULT seq 10 permit any
<% end -%>
router ospf
ospf router-id <%= @ospfd_router_id %>
log-adjacency-changes detail
<% @ospfd_redistribute.each do |type| -%>
<% if @ospf_exclude_k8s_enable && type == 'connected' && (@k8s_cluster_cidr || @k8s_service_cidr) -%>
redistribute connected route-map CONNECTED-NON-K8S
<% elsif type == 'connected' && @ospfd_redistribute_connected_permit.any? -%>
redistribute connected route-map CONNECTED-PERMIT
<% else -%>
redistribute <%= type %>
<% end -%>
@@ -41,6 +59,9 @@ router ospf
<% @ospfd_networks.each do |network| -%>
network <%= network %>
<% end -%>
<% if @ospfd_deny_default_in -%>
distribute-list NO-DEFAULT in
<% end -%>
<% if @ospfd_default_originate_always -%>
default-information originate always
<% end -%>
+2
View File
@@ -4,6 +4,8 @@ define wireguard::interface (
Optional[Stdlib::Port] $listen_port = undef,
Optional[Integer[1280, 9000]] $mtu = undef,
Optional[Sensitive[String[1]]] $private_key = undef,
Optional[String[1]] $table = undef,
Array[String[1]] $post_up = [],
Array[Struct[{
public_key => String[1],
allowed_ips => Variant[String[1], Array[String[1], 1]],
+6
View File
@@ -9,11 +9,17 @@ ListenPort = <%= @listen_port %>
<% if @mtu -%>
MTU = <%= @mtu %>
<% end -%>
<% if @table -%>
Table = <%= @table %>
<% end -%>
<% if @key -%>
PrivateKey = <%= @key %>
<% else -%>
PostUp = wg set %i private-key /etc/wireguard/%i.key
<% end -%>
<% @post_up.each do |cmd| -%>
PostUp = <%= cmd %>
<% end -%>
<% @peers.each do |peer| -%>
[Peer]
@@ -0,0 +1,12 @@
# roles::infra::network::wgvpn
# a wireguard vpn edge host; routes its vpc to the lab over wg0 with ospf
#
class roles::infra::network::wgvpn {
if $facts['firstrun'] {
include profiles::defaults
include profiles::firstrun::init
}else{
include profiles::defaults
include profiles::base
}
}