Compare commits

...
2 Commits
Author SHA1 Message Date
oliver ed4fa767b0 u 2026-10-13 09:04:22 -03:00
oliver df86400eb5 o 2026-10-13 09:04:10 -03:00
2 changed files with 7 additions and 5 deletions

No files matched your search

+5 -3
View File
@@ -15,6 +15,11 @@ localfile="$1"
remotefile="$2" remotefile="$2"
remotetmp_base="/var/tmp/4server" remotetmp_base="/var/tmp/4server"
# If the destination is a directory (trailing slash), keep the local file name
case "$remotefile" in
*/) remotefile="${remotefile}$(basename "$localfile")" ;;
esac
# Read hosts from file descriptor 3 to prevent ssh from consuming stdin # Read hosts from file descriptor 3 to prevent ssh from consuming stdin
while read -r host <&3; do while read -r host <&3; do
host_env_file="$host_vars_dir/$host/$host.env" host_env_file="$host_vars_dir/$host/$host.env"
@@ -34,7 +39,6 @@ while read -r host <&3; do
SSH_PRIVATE=$(<"$host_vars_dir/$host/$host") SSH_PRIVATE=$(<"$host_vars_dir/$host/$host")
SSH_PUBLIC=$(<"$host_vars_dir/$host/$host.pub") SSH_PUBLIC=$(<"$host_vars_dir/$host/$host.pub")
content=$(<"$localfile") content=$(<"$localfile")
for key in "${keys[@]}"; do for key in "${keys[@]}"; do
@@ -42,7 +46,6 @@ while read -r host <&3; do
# Replace placeholder {{KEY}} with value using Bash's parameter expansion # Replace placeholder {{KEY}} with value using Bash's parameter expansion
content="${content//\{\{$key\}\}/$value}" content="${content//\{\{$key\}\}/$value}"
done done
# Copy content to remote temporary file # Copy content to remote temporary file
remotetmp="${remotetmp_base}_${host}" remotetmp="${remotetmp_base}_${host}"
echo "Copying to $host:$remotefile" echo "Copying to $host:$remotefile"
@@ -52,4 +55,3 @@ while read -r host <&3; do
ssh "$host" "doas mv '$remotetmp' '$remotefile'" ssh "$host" "doas mv '$remotetmp' '$remotefile'"
done 3< /app/host_vars/hosts done 3< /app/host_vars/hosts
+2 -2
View File
@@ -35,8 +35,8 @@ prsync -h "/app/host_vars/hosts" -avz ./sbin/ /4server/sbin/
### POSTGRESS ### POSTGRESS
rex mkdir -p /4server/data/postgres/etc rex mkdir -p /4server/data/postgres/etc
template templates/pg_hba.conf /4server/data/postgres/etc/ template templates/pg_hba.conf /4server/data/postgres/etc/pg_hba.conf
template templates/postgresql.conf /4server/data/postgres/etc/ template templates/postgresql.conf /4server/data/postgres/etc/postgresql.conf