This commit is contained in:
Michael Grote 2023-07-21 20:58:50 +02:00
parent d7b94d73b9
commit 50bdaa7098
2 changed files with 4 additions and 4 deletions

4
app.sh
View File

@ -55,7 +55,7 @@ while true ; do
# Set the IFS to a comma to split the values
IFS=','
while read -r FQDN SSH_KEY_PATH; do
while read -r FQDN USERNAME SSH_KEY_PATH; do
# bereinige FQDN
FQDN=$(echo "$FQDN" | tr -d "[:space:]")
# prüfe ob Key existiert
@ -65,7 +65,7 @@ while true ; do
exit 2
fi
echo "export $FQDN config"
ssh -n -o StrictHostKeyChecking=no -i "$SSH_KEY_PATH" "$FQDN" "/export show-sensitive" > "config_${FQDN}.rsc"
ssh -n -o StrictHostKeyChecking=no -i "$SSH_KEY_PATH" "${USERNAME}@${FQDN}" "/export show-sensitive" > "config_${FQDN}.rsc" 2> /dev/null
# entferne Datumszeile
sed -i -r '/^# [0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}\:[0-9]{2}\:[0-9]{2}\sby\sRouterOS\s[0-9\s\.]+/d' "config_${FQDN}.rsc"
git add "config_${FQDN}.rsc"

View File

@ -16,8 +16,8 @@ services:
environment:
# Format <FQDN>,<SSH_KEY_PATH to ssh-private-key(passwordless)> #siehe volunmes
DEVICES: |
rb5009.grote.lan,/neu
hex.grote.lan,/ssh/keys/hex
rb5009.grote.lan,admin,/neu
hex.grote.lan,admin,/ssh/keys/hex
GIT_REPO_BRANCH: "master"
GIT_REPO_URL: "ssh://gitea@git.mgrote.net:2222/mg/testrepo.git"
GIT_REPO_DEPLOY_KEY: "/neu" #siehe volunmes