mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-11-22 07:26:25 +00:00
23 lines
No EOL
430 B
Bash
Executable file
23 lines
No EOL
430 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
|
|
|
|
export ANSIBLE_HOST_KEY_CHECKING=False
|
|
export ANSIBLE_FORCE_COLOR=True
|
|
|
|
ansible-playbook "$options" "$playbook" |