Merge pull request #1511 from ceph/rm-ansible-install

ceph-aio-no-vagrant.sh: check if ansible is installed
pull/1398/merge
Sébastien Han 2017-05-11 22:50:27 +02:00 committed by GitHub
commit 9422ab4039
1 changed files with 11 additions and 8 deletions

View File

@ -18,7 +18,7 @@ INSTALL_RGW=true
# FUNCTIONS # FUNCTIONS
show_help() { show_help() {
PROG=$(basename $0) PROG=$(basename "$0")
echo "" echo ""
echo "Usage of ${PROG}:" echo "Usage of ${PROG}:"
cat << EOF cat << EOF
@ -94,16 +94,19 @@ fi
} }
function install_ansible { function is_ansible_installed {
bash install-ansible.sh if ! command -v ansible-playbook 1&> /dev/null; then
echo "Please install Ansible"
exit 1
fi
} }
function ssh_setup { function ssh_setup {
if [ ! -f $HOME/.ssh/id_rsa ]; then if [ ! -f "$HOME"/.ssh/id_rsa ]; then
echo -e 'y\n'|ssh-keygen -q -t rsa -N "" -f $HOME/.ssh/id_rsa echo -e 'y\n'|ssh-keygen -q -t rsa -N "" -f "$HOME"/.ssh/id_rsa
fi fi
if ! grep -Fxq "$(cat $HOME/.ssh/id_rsa.pub)" $HOME/.ssh/authorized_keys; then if ! grep -Fxq "$(cat "$HOME"/.ssh/id_rsa.pub)" "$HOME"/.ssh/authorized_keys; then
cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys cat "$HOME"/.ssh/id_rsa.pub >> "$HOME"/.ssh/authorized_keys
fi fi
} }
@ -168,7 +171,7 @@ function test_and_run {
# MAIN # MAIN
parse_cmdline $@ parse_cmdline $@
install_ansible is_ansible_installed
ssh_setup ssh_setup
cp_var cp_var
populate_vars populate_vars