14 lines
357 B
Bash
Executable File
14 lines
357 B
Bash
Executable File
#!/bin/bash
|
|
|
|
cmd="$*"
|
|
|
|
# Build a temporary hosts file without comments (# ...) and blank lines
|
|
tmp_hosts=$(mktemp)
|
|
trap 'rm -f "$tmp_hosts"' EXIT
|
|
sed -e 's/#.*$//' -e 's/[[:space:]]*$//' -e '/^[[:space:]]*$/d' /app/host_vars/hosts > "$tmp_hosts"
|
|
|
|
echo "Running on hosts: $(tr '\n' ' ' < "$tmp_hosts")"
|
|
echo "Command: $cmd"
|
|
|
|
pssh -h "$tmp_hosts" -t 0 "$cmd"
|