This commit is contained in:
Oliver
2025-08-13 09:23:21 +02:00
parent dfca0844f0
commit 140a712abf
9 changed files with 28 additions and 17 deletions

View File

@@ -1,13 +1,15 @@
#!/bin/bash
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <localfile> <remotefile> <host_vars_dir>"
echo "Usage: $0 <localfile> <remotefile>"
exit 1
fi
localfile="$1"
remotefile="$2"
host_vars_dir="$3"
remotetmp="/var/tmp/4server"
while read -r host; do
echo "Processing host: $host"
@@ -32,7 +34,8 @@ while read -r host; do
done
echo "Copying to $host:$remotefile"
echo "$content" | ssh "$host" "cat > $remotefile"
echo "$content" | ssh "$host" "cat > $remotetmp"
rex doas mv $remotetmp $remotefile
done < "$hosts_file"