aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2024-12-14 01:15:22 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2024-12-14 01:15:22 +0100
commit9e4d30571a9f1f28bb984eae7a94d9913d873abf (patch)
tree12387e62e470afe522b3f4b8cb180465f55de6b3
parent9a9cbb2535bfc2a9c26a8b12085fb8fee131f7a7 (diff)
downloadansible-memzero-9e4d30571a9f1f28bb984eae7a94d9913d873abf.tar.gz
ansible-memzero-9e4d30571a9f1f28bb984eae7a94d9913d873abf.zip
mirror: disable key verif, when accesing server via podman network
-rw-r--r--roles/git/files/runner-mirror/config7
-rwxr-xr-xroles/git/files/runner-mirror/mirror.sh9
2 files changed, 15 insertions, 1 deletions
diff --git a/roles/git/files/runner-mirror/config b/roles/git/files/runner-mirror/config
index 7e88cb7..8fd99fe 100644
--- a/roles/git/files/runner-mirror/config
+++ b/roles/git/files/runner-mirror/config
@@ -1,3 +1,10 @@
+host cgito
+ identityfile /mirror.key
+ user git
+ # Connection on localhost (podman network), ignore key verification.
+ StrictHostKeyChecking no
+ UserKnownHostsFile=/dev/null
+
host git.memzero.de
identityfile /mirror.key
user git
diff --git a/roles/git/files/runner-mirror/mirror.sh b/roles/git/files/runner-mirror/mirror.sh
index 0aade9d..9a3c04b 100755
--- a/roles/git/files/runner-mirror/mirror.sh
+++ b/roles/git/files/runner-mirror/mirror.sh
@@ -1,5 +1,12 @@
#!/bin/sh
+# Access git server through podman network if available.
+if ping -c 1 cgito &> /dev/null; then
+ HOST=cgito
+else
+ HOST=git.memzero.de
+fi
+
function mirror() {
local repo=$1
@@ -9,7 +16,7 @@ function mirror() {
git -C $repo fetch --all --prune
fi
- git -C $repo push --mirror ssh://git.memzero.de/mirror/$repo
+ git -C $repo push --mirror ssh://$HOST/mirror/$repo
}
function lock() {