-
Notifications
You must be signed in to change notification settings - Fork 4
/
bonded.py
29 lines (24 loc) · 987 Bytes
/
bonded.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from .. import NetworkBuilder
from ...utils import generate_persistent_names_udev
class DebianBondedNetwork(NetworkBuilder):
def build(self):
if self.network.bonding.link_aggregation not in ("bonded", "mlag_ha"):
return
super().build()
self.build_tasks()
def build_tasks(self):
if (
self.metadata.operating_system.distro == "debian"
and self.metadata.operating_system.version == "10"
):
# Debian10 is failing if we don't configure the net this way
self.task_template(
"etc/network/interfaces", "bonded/etc_network_interfaces_debian10.j2"
)
else:
self.task_template(
"etc/network/interfaces", "bonded/etc_network_interfaces.j2"
)
self.task_template("etc/modules", "bonded/etc_modules.j2", write_mode="a")
self.tasks.update(generate_persistent_names_udev())
return self.tasks