mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-12-28 02:56:09 -07:00
main: add directory input
This commit is contained in:
parent
106317ddaa
commit
6125b23431
8
main.sh
8
main.sh
|
@ -3,6 +3,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
playbook="$INPUT_PLAYBOOK"
|
playbook="$INPUT_PLAYBOOK"
|
||||||
|
directory="$INPUT_DIRECTORY"
|
||||||
key="$INPUT_KEY"
|
key="$INPUT_KEY"
|
||||||
options="$INPUT_OPTIONS"
|
options="$INPUT_OPTIONS"
|
||||||
|
|
||||||
|
@ -11,11 +12,18 @@ if test -z "$playbook"; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if test -z "$key"; then
|
||||||
echo "You need to specify 'key' input (SSH private key)"
|
echo "You need to specify 'key' input (SSH private key)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cd "$directory"
|
||||||
|
|
||||||
mkdir -p "$HOME/.ssh"
|
mkdir -p "$HOME/.ssh"
|
||||||
echo "$key" > "$HOME/.ssh/id_rsa"
|
echo "$key" > "$HOME/.ssh/id_rsa"
|
||||||
chmod 600 "$HOME/.ssh/id_rsa"
|
chmod 600 "$HOME/.ssh/id_rsa"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user