This commit is contained in:
Michael Grote 2023-07-21 20:51:06 +02:00
parent 24aa1bc3d1
commit 23b90cb509
2 changed files with 26 additions and 29 deletions

30
app.sh
View File

@ -1,27 +1,7 @@
#!/bin/bash
# setze Variable
# Format <FQDN>,<SSH_KEY_PATH to ssh-private-key(passwordless)>
DEVICES="rb5009.grote.lan,/home/mg/oxidized-selfmade/neu
hex.grote.lan,/ssh/keys/hex"
GIT_REPO_PATH=/home/mg/oxidized-selfmade # wo soll das Repo angelegt werden
GIT_REPO_BRANCH=master
GIT_USERNAME=oxidized-selfmade
GIT_USER_MAIL=michael.grote@posteo.de
GIT_REPO_REMOTE_NAME=origin
INTERVAL=3600 # in Sekunden
FAILFILE=$(mktemp)
while true ; do
# Checks
if [ -z "$GIT_REPO_PATH" ] ; then
echo "GIT_REPO_PATH is not set."
exit 3
fi
if [ -z "$INTERVAL" ] ; then
echo "INTERVAL is not set."
exit 3
@ -46,6 +26,16 @@ while true ; do
echo "DEVICES is not set."
exit 3
fi
if [ -z "$GIT_REPO_DEPLOY_KEY" ] ; then
echo "GIT_REPO_DEPLOY_KEY is not set."
exit 3
fi
if [ -z "$GIT_REPO_URL" ] ; then
echo "GIT_REPO_URL is not set."
exit 3
fi
GIT_REPO_PATH=$(/tmp/tmp.gUcRmxSldg)
git config --global user.email "$GIT_USER_MAIL"
git config --global user.name "$GIT_USERNAME"

View File

@ -3,18 +3,25 @@ version: "3"
services:
routeros-config-export:
image: registry.mgrote.net/oxidized-selfmade:latest
environment:
- DEVICE_CONFIGS=rb5009.grote.lan,test,/keys/rb5009
- GIT_REPO_PATH=/repo
- GIT_REPO_URL=ssh://gitea@git.mgrote.net:2222/mg/network-configs.git
- GIT_USERNAME=gitea # nur für comitter name
- GIT_SSH_KEY=/keys/git
volumes:
# key rb5009
- ./keys/rb5009:/keys/rb5009:ro
# git
- ./keys/git:/keys/git:ro
- /home/mg/neu:/neu:ro
# Add any other volumes or configurations needed
# der zweite key für admin auf dem router ist der hier, in irantu/wsl hinterlegt
environment:
# Format <FQDN>,<SSH_KEY_PATH to ssh-private-key(passwordless)> #siehe volunmes
- DEVICES: |
rb5009.grote.lan,/neu
hex.grote.lan,/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
- GIT_USERNAME: oxidized-selfmade
- GIT_USER_MAIL: michael.grote@posteo.de
- GIT_REPO_REMOTE_NAME: origin
- INTERVAL: 3600 # in Sekunden