From a22ae5a467432e7546d4f10adab36f743278ae6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Wed, 10 May 2017 20:00:13 +0200 Subject: [PATCH] ceph-aio-no-vagrant.sh: check if ansible is installed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we don't provide install-ansible.sh anymore we just check if it exists. If not we fail and ask for installation. Signed-off-by: Sébastien Han --- ceph-aio-no-vagrant.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ceph-aio-no-vagrant.sh b/ceph-aio-no-vagrant.sh index f9d7c5a3a..602588c3e 100755 --- a/ceph-aio-no-vagrant.sh +++ b/ceph-aio-no-vagrant.sh @@ -18,7 +18,7 @@ INSTALL_RGW=true # FUNCTIONS show_help() { - PROG=$(basename $0) + PROG=$(basename "$0") echo "" echo "Usage of ${PROG}:" cat << EOF @@ -94,16 +94,19 @@ fi } -function install_ansible { - bash install-ansible.sh +function is_ansible_installed { + if ! command -v ansible-playbook 1&> /dev/null; then + echo "Please install Ansible" + exit 1 + fi } function ssh_setup { - if [ ! -f $HOME/.ssh/id_rsa ]; then - echo -e 'y\n'|ssh-keygen -q -t rsa -N "" -f $HOME/.ssh/id_rsa + if [ ! -f "$HOME"/.ssh/id_rsa ]; then + echo -e 'y\n'|ssh-keygen -q -t rsa -N "" -f "$HOME"/.ssh/id_rsa fi - if ! grep -Fxq "$(cat $HOME/.ssh/id_rsa.pub)" $HOME/.ssh/authorized_keys; then - cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys + if ! grep -Fxq "$(cat "$HOME"/.ssh/id_rsa.pub)" "$HOME"/.ssh/authorized_keys; then + cat "$HOME"/.ssh/id_rsa.pub >> "$HOME"/.ssh/authorized_keys fi } @@ -168,7 +171,7 @@ function test_and_run { # MAIN parse_cmdline $@ -install_ansible +is_ansible_installed ssh_setup cp_var populate_vars