From b2cd0ef1e61611eaf5e708780120a41100213486 Mon Sep 17 00:00:00 2001 From: SebClem Date: Wed, 15 Dec 2021 17:50:23 +0100 Subject: [PATCH] :ambulance: Fix ssh key --- entrypoint | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/entrypoint b/entrypoint index 392f11e..bf760d7 100755 --- a/entrypoint +++ b/entrypoint @@ -3,6 +3,12 @@ check=${PLUGIN_CHECK_SYNTAX:-false} verbosity=${PLUGIN_VERBOSITY:-0} +run_command(){ + echo "\$ $@" + $($@) +} + + if [[ -z "$PLUGIN_PLAYBOOK" ]]; then echo -e "\e[31m'playbook' setting not defined, ABORT!\e[39m" exit 1 @@ -11,21 +17,22 @@ fi if [[ -z "$PLUGIN_PRIVATE_KEY" ]]; then echo -e "\e[31m[WARN] 'private_key' setting not defined !\e[39m" else - echo "$PLUGIN_PRIVATE_KEY" > /root/.ssh/id_ed - chmod 400 /root/.ssh/id_ed + + run_command mkdir /root/.ssh + run_command echo "$PLUGIN_PRIVATE_KEY" > /root/.ssh/id_ed + run_command chmod 400 /root/.ssh/id_ed fi if [[ -n "$PLUGIN_VAULT_TOKEN" ]]; then echo "Adding vault token to 'credentials/vault_token'" - mkdir credentials - echo $PLUGIN_VAULT_TOKEN > credentials/vault_token + run_command mkdir credentials + run_command echo $PLUGIN_VAULT_TOKEN > credentials/vault_token echo "" fi if [[ -n "$PLUGIN_GALAXY_FILE" ]]; then echo "Installing Galaxy dependencies ($PLUGIN_GALAXY_FILE)" - echo "\$ ansible-galaxy install -r $PLUGIN_GALAXY_FILE --force" - ansible-galaxy install -r $PLUGIN_GALAXY_FILE --force + run_command ansible-galaxy install -r $PLUGIN_GALAXY_FILE --force echo "" fi @@ -46,6 +53,5 @@ if [[ -n "$PLUGIN_LIMIT" ]]; then args="${args} --limit \"$PLUGIN_LIMIT\"" fi -echo "\$ ansible-playbook $args" -export ANSIBLE_HOST_KEY_CHECKING=False -ansible-playbook $args \ No newline at end of file +run_command export ANSIBLE_HOST_KEY_CHECKING=False +run_command ansible-playbook $args \ No newline at end of file