Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9337262
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
View Options
diff --git a/site-modules/profile/manifests/network.pp b/site-modules/profile/manifests/network.pp
index f36e6a7b..6d77ca8e 100644
--- a/site-modules/profile/manifests/network.pp
+++ b/site-modules/profile/manifests/network.pp
@@ -1,70 +1,71 @@
# Network configuration for Software Heritage servers
class profile::network {
debnet::iface::loopback { 'lo': }
# The network description is expected to be a dict of key route_label
# (values: private, default) and value a dict describing the interface.
# The interface dict has the following possible keys:
# - interface: interface's name
# - address: ip address for the node
# - netmask: netmask
# - gateway: to use for the network
# - ups: Post instruction when the interface is up
# - downs: Post instructions to run when the interface is teared down
$interfaces = lookup('networks')
$private_routes = lookup('networks::private_routes', Hash, 'deep')
each($interfaces) |$interface, $data| {
$interface_type = pick($data['type'], 'static')
if $interface_type == 'private' {
file_line {'private route table':
ensure => 'present',
line => '42 private',
path => '/etc/iproute2/rt_tables',
}
$filtered_routes = $private_routes.filter |$route_label, $route_data| { pick($route_data['enabled'], true) }
$routes_up = $filtered_routes.map |$route_label, $route_data| {
"ip route add ${route_data['network']} via ${route_data['gateway']}"
}
$routes_down = $filtered_routes.map |$route_label, $route_data| {
"ip route del ${route_data['network']} via ${route_data['gateway']}"
}.reverse
$_ups = $routes_up + [
"ip rule add from ${data['address']} table private",
"ip route add 192.168.100.0/24 src ${data['address']} dev ${interface} table private",
"ip route add default via ${data['gateway']} dev ${interface} table private",
'ip route flush cache',
]
$_downs = [
"ip route del default via ${data['gateway']} dev ${interface} table private",
"ip route del 192.168.100.0/24 src ${data['address']} dev ${interface} table private",
"ip rule del from ${data['address']} table private",
] + $routes_down + [
'ip route flush cache',
]
$method = 'static'
$gateway = undef
} else {
$method = $interface_type
$gateway = $data['gateway']
$_ups = []
$_downs = []
}
debnet::iface { $interface:
method => $method,
address => $data['address'],
netmask => $data['netmask'],
+ mtu => $data['mtu'],
gateway => $gateway,
ups => pick_default($data['ups'], $_ups, []),
downs => pick_default($data['downs'], $_downs, []),
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Jul 4 2025, 7:58 AM (10 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3294016
Attached To
rSPSITE puppet-swh-site
Event Timeline
Log In to Comment