mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-12-28 11:06:09 -07:00
main: make key input required
This commit is contained in:
parent
9dfdfbebf6
commit
3b5446324b
12
main.sh
12
main.sh
|
@ -11,16 +11,20 @@ if test -z "$playbook"; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$key"; then
|
if test -z "$key"; then
|
||||||
mkdir -p ~/.ssh
|
echo "You need to specify 'key' input (SSH private key)"
|
||||||
echo "$key" > ~/.ssh/id_rsa
|
exit 1
|
||||||
chmod 400 ~/.ssh/id_rsa
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$HOME/.ssh"
|
||||||
|
echo "$key" > "$HOME/.ssh/id_rsa"
|
||||||
|
chmod 600 "$HOME/.ssh/id_rsa"
|
||||||
|
|
||||||
echo "$options"
|
echo "$options"
|
||||||
echo "$playbook"
|
echo "$playbook"
|
||||||
|
|
||||||
export ANSIBLE_HOST_KEY_CHECKING=False
|
export ANSIBLE_HOST_KEY_CHECKING=False
|
||||||
export ANSIBLE_FORCE_COLOR=True
|
export ANSIBLE_FORCE_COLOR=True
|
||||||
|
export ANSIBLE_PRIVATE_KEY_FILE="$HOME/.ssh/id_rsa"
|
||||||
|
|
||||||
ansible-playbook $options $playbook
|
ansible-playbook $options $playbook
|
Loading…
Reference in New Issue
Block a user