action-ansible-playbook/main.sh
Dawid Dziurla 36026d33a9
main: yep, options could be passed as they are
just print them + playbook
2020-03-21 17:17:56 +01:00

26 lines
460 B
Bash
Executable File

#!/bin/bash
set -e
playbook="$INPUT_PLAYBOOK"
key="$INPUT_KEY"
options="$INPUT_OPTIONS"
if test -z "$playbook"; then
echo "You need to specify 'playbook' input (Ansible playbook filepath)"
exit 1
fi
if test -n "$key"; then
mkdir -p ~/.ssh
echo "$key" > ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
fi
echo "$options"
echo "$playbook"
export ANSIBLE_HOST_KEY_CHECKING=False
export ANSIBLE_FORCE_COLOR=True
ansible-playbook $options $playbook