#!/bin/bash declare -a args # Allows to attach to a shell inside the container, or run ansbile commands, # otherwise run the 'hpa' script with the given arguments. # while [[ $# -gt 0 ]]; do if [[ $1 == "/bin/bash" ]] || [[ $1 == "bash" ]]; then shift /bin/bash "$@" exit $? elif [[ $1 == "/bin/sh" ]] || [[ $1 == "sh" ]]; then shift /bin/sh "$@" exit $? elif [[ $1 =~ ^ansible ]]; then exec "$@" exit $? else args+=("$1") fi shift done # If we made it here then run the hpa script. /usr/local/bin/hpa "${args[@]}"