2020-03-21 16:06:40 +00:00
|
|
|
#!/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
|
|
|
|
|
2020-03-21 16:10:07 +00:00
|
|
|
if test -n "$options"; then
|
2020-03-21 16:12:34 +00:00
|
|
|
#options="$(echo "$options" | tr '\n' ' ')"
|
2020-03-21 16:10:07 +00:00
|
|
|
echo "OPTIONS: $options"
|
|
|
|
fi
|
|
|
|
|
2020-03-21 16:06:40 +00:00
|
|
|
export ANSIBLE_HOST_KEY_CHECKING=False
|
|
|
|
export ANSIBLE_FORCE_COLOR=True
|
|
|
|
|
2020-03-21 16:12:34 +00:00
|
|
|
ansible-playbook $options $playbook
|