Michael Grote
696c4b901d
config_hex.grote.lan.rsc config_rb5009.grote.lan.rsc docker-compose.yml keys/git keys/git.pub keys/rb5009 keys/rb5009.pub neu neu.pub x Signed-off-by: Michael Grote <michael.grote@posteo.de>
39 lines
926 B
Bash
39 lines
926 B
Bash
#!/bin/bash
|
|
|
|
# setze Variable
|
|
devices="rb5009.grote.lan,/home/mg/oxidized-selfmade/neu
|
|
hex.grote.lan,/ssh/keys/hex"
|
|
GIT_REPO_PATH=/home/mg/oxidized-selfmade
|
|
|
|
|
|
# Save the current value of IFS to restore later
|
|
OLD_IFS=$IFS
|
|
|
|
# Set the IFS to a comma to split the values
|
|
IFS=','
|
|
|
|
# Loop through the lines in the variable
|
|
while read -r fqdn path; do
|
|
# Print the variables (you can perform any actions you need here)
|
|
fqdn=$(echo $fqdn | tr -d "[:space:]")
|
|
|
|
ssh -n -i ${path} ${fqdn} "/export show-sensitive" > config_${fqdn}.rsc
|
|
done <<< "$devices"
|
|
|
|
# Restore the original IFS value
|
|
IFS=$OLD_IFS
|
|
|
|
if [ -d "$GIT_REPO_PATH" ]; then
|
|
cd "$GIT_REPO_PATH"
|
|
if [ -d ".git" ]; then
|
|
git pull origin master
|
|
else
|
|
echo "Error: The directory exists but is not a Git repository."
|
|
exit 1
|
|
fi
|
|
else
|
|
git clone "$GIT_REPO_URL" "$GIT_REPO_PATH"
|
|
fi
|
|
|
|
|
|
|