main: add directory input

This commit is contained in:
Dawid Dziurla 2020-03-24 22:23:41 +01:00
parent 106317ddaa
commit 6125b23431
No known key found for this signature in database
GPG Key ID: 7B6D8368172E9B0B

View File

@ -3,6 +3,7 @@
set -e
playbook="$INPUT_PLAYBOOK"
directory="$INPUT_DIRECTORY"
key="$INPUT_KEY"
options="$INPUT_OPTIONS"
@ -11,11 +12,18 @@ if test -z "$playbook"; then
exit 1
fi
if test -z "$directory"; then
echo "You need to specify 'directory' input (root Ansible project directory)"
exit 1
fi
if test -z "$key"; then
echo "You need to specify 'key' input (SSH private key)"
exit 1
fi
cd "$directory"
mkdir -p "$HOME/.ssh"
echo "$key" > "$HOME/.ssh/id_rsa"
chmod 600 "$HOME/.ssh/id_rsa"