30 lines
538 B
Bash
Executable File
30 lines
538 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ $# < 2 ]]; then
|
|
cat <<HELP
|
|
Wrapper script for ansible-playbook to apply single role.
|
|
|
|
Usage: $0 <host-pattern> <role-name> [ansible-playbook options]
|
|
|
|
Examples:
|
|
$0 dest_host my_role
|
|
$0 custom_host my_role -i 'custom_host,' -vv --check
|
|
HELP
|
|
exit 1
|
|
fi
|
|
|
|
HOST_PATTERN=$1
|
|
shift
|
|
ROLE=$1
|
|
shift
|
|
|
|
echo "Trying to apply role \"$ROLE\" to host/group \"$HOST_PATTERN\"..."
|
|
|
|
ansible-playbook "$@" /dev/stdin <<END
|
|
---
|
|
- hosts: $HOST_PATTERN
|
|
roles:
|
|
- $ROLE
|
|
END
|
|
# vim: set tabstop=4 shiftwidth=4 expandtab smarttab:
|