#!/bin/sh user="siv" function playbook() { book="${1:-"site.yml"}" opts="" [ ! -z "$2" ] && opts="-t $2" ansible-playbook "$book" "$opts" -i docker.ini } case "$1" in play) book="${2:-"site.yml"}" # opts="" # [ ! -z "$3" ] && opts="-t $3" ansible-playbook "$book" -i docker.ini;; # playbook "$2" "$3";; kill) docker kill ansible;; run) docker run --rm --name ansible -id alpine [ "$?" == "0" ] && docker exec ansible /bin/sh -c "apk update && apk add python3" ansible -i docker.ini all -m ping;; zsh) docker exec -itu "$user" ansible zsh;; sh) docker exec -it ansible sh;; "")echo "Usage: $0 [run|kill|play|sh|{container cmd}]";; *) docker exec -itu "$user" ansible "$@";; esac