filter hosts
This commit is contained in:
1 parent
ac65ba2169
commit
9abed9f2e9
3 files changed
+13
-3
No files matched your search
+7
-2
@@ -2,7 +2,12 @@
|
||||
|
||||
cmd="$*"
|
||||
|
||||
echo "Running on hosts: $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"
|
||||
|
||||
pssh -h /app/host_vars/hosts -t 0 "$cmd"
|
||||
echo "Running on hosts: $(tr '\n' ' ' < "$tmp_hosts")"
|
||||
echo "Command: $cmd"
|
||||
|
||||
pssh -h "$tmp_hosts" -t 0 "$cmd"
|
||||
Reference in new issue
Block a user