Skip to content

Instantly share code, notes, and snippets.

@pol
Created July 2, 2014 22:45
Show Gist options
  • Select an option

  • Save pol/e845be49480f88295a42 to your computer and use it in GitHub Desktop.

Select an option

Save pol/e845be49480f88295a42 to your computer and use it in GitHub Desktop.
ansible-role shell script
#!/bin/sh
if [ $# -lt 1 ]; then
echo "Usage: ansible-role ROLE ARGS...\n(see ansible-playbook --help for args)"
exit 1
fi
ROLE=$1
shift
OPTS=$*
echo "---\n- hosts: $ROLE\n roles:\n - $ROLE\n" > .tmp.yml
ansible-playbook .tmp.yml $OPTS
rm .tmp.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment