lab-ansible/tools/cmd.sh

12 lines
157 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2024-01-30 19:55:48 +00:00
if [[ $1 == "-i" ]]; then
ARGS="-i $2"
shift 2
fi
HOSTS="$1"
CMD="$2"
2024-01-30 19:55:48 +00:00
eval "ansible $ARGS -b -m shell -a \"$CMD\" \"$HOSTS\""