Skip to content

Commit f459f73

Browse files
authored
Merge pull request #21 from zerodha/bridge
feat: load bridge network manually
2 parents 3aef8e3 + c7c1c35 commit f459f73

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

modules/nomad-clients/scripts/setup_client.tftpl.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,21 @@ modify_nomad_systemd_config() {
9494
fi
9595
}
9696

97+
# Function to check and load the bridge module
98+
load_bridge() {
99+
if ! lsmod | grep -q "^bridge"; then
100+
log "INFO" "Bridge module not loaded. Attempting to load..."
101+
if ! modprobe bridge; then
102+
log "ERROR" "Failed to load bridge module. This might affect network functionality."
103+
else
104+
log "INFO" "Bridge module loaded successfully."
105+
fi
106+
else
107+
log "INFO" "Bridge module is already loaded."
108+
fi
109+
}
110+
111+
97112
# Enables nomad systemd service
98113
start_nomad() {
99114
sudo systemctl daemon-reload
@@ -133,7 +148,7 @@ $(for tag in "$${AWS_TAGS[@]}"; do
133148
"/lib64" = "/lib64"
134149
"/sbin" = "/sbin"
135150
"/usr" = "/usr"
136-
151+
137152
"/etc/ld.so.cache" = "/etc/ld.so.cache"
138153
"/etc/ld.so.conf" = "/etc/ld.so.conf"
139154
"/etc/ld.so.conf.d" = "/etc/ld.so.conf.d"
@@ -219,6 +234,9 @@ set_hostname
219234
log "INFO" "Prepare DNS config for exec tasks"
220235
prepare_dns_config
221236

237+
log "INFO" "Checking and loading bridge module"
238+
load_bridge
239+
222240
log "INFO" "Rendering client config for nomad"
223241
prepare_nomad_client_config
224242

0 commit comments

Comments
 (0)