From 6125b234312cf8108f240d9e053567297cfeb9ed Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Tue, 24 Mar 2020 22:23:41 +0100 Subject: [PATCH] main: add directory input --- main.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.sh b/main.sh index c16dbc5..6e15928 100755 --- a/main.sh +++ b/main.sh @@ -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"