Skip to content

Commit

Permalink
feat: load bridge network manually
Browse files Browse the repository at this point in the history
fixes #20
  • Loading branch information
mr-karan committed Jul 13, 2024
1 parent 3aef8e3 commit c7c1c35
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion modules/nomad-clients/scripts/setup_client.tftpl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,21 @@ modify_nomad_systemd_config() {
fi
}

# Function to check and load the bridge module
load_bridge() {
if ! lsmod | grep -q "^bridge"; then
log "INFO" "Bridge module not loaded. Attempting to load..."
if ! modprobe bridge; then
log "ERROR" "Failed to load bridge module. This might affect network functionality."
else
log "INFO" "Bridge module loaded successfully."
fi
else
log "INFO" "Bridge module is already loaded."
fi
}


# Enables nomad systemd service
start_nomad() {
sudo systemctl daemon-reload
Expand Down Expand Up @@ -133,7 +148,7 @@ $(for tag in "$${AWS_TAGS[@]}"; do
"/lib64" = "/lib64"
"/sbin" = "/sbin"
"/usr" = "/usr"
"/etc/ld.so.cache" = "/etc/ld.so.cache"
"/etc/ld.so.conf" = "/etc/ld.so.conf"
"/etc/ld.so.conf.d" = "/etc/ld.so.conf.d"
Expand Down Expand Up @@ -219,6 +234,9 @@ set_hostname
log "INFO" "Prepare DNS config for exec tasks"
prepare_dns_config

log "INFO" "Checking and loading bridge module"
load_bridge

log "INFO" "Rendering client config for nomad"
prepare_nomad_client_config

Expand Down

0 comments on commit c7c1c35

Please sign in to comment.