diff options
Diffstat (limited to 'deploy/compass_vm.sh')
-rwxr-xr-x | deploy/compass_vm.sh | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/deploy/compass_vm.sh b/deploy/compass_vm.sh index cc0471ae..cf215f3b 100755 --- a/deploy/compass_vm.sh +++ b/deploy/compass_vm.sh @@ -10,6 +10,26 @@ compass_vm_dir=$WORK_DIR/vm/compass rsa_file=$compass_vm_dir/boot.rsa ssh_args="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i $rsa_file" + +function check_container_alive() { + docker exec -it compass-deck bash -c "exit" 1>/dev/null 2>&1 + local deck_state=$? + docker exec -it compass-tasks bash -c "exit" 1>/dev/null 2>&1 + local tasks_state=$? + docker exec -it compass-cobbler bash -c "exit" 1>/dev/null 2>&1 + local cobbler_state=$? + docker exec -it compass-db bash -c "exit" 1>/dev/null 2>&1 + local db_state=$? + docker exec -it compass-mq bash -c "exit" 1>/dev/null 2>&1 + local mq_state=$? + + if [ $((deck_state||tasks_state||cobbler_state||db_state||mq-state)) == 0 ]; then + echo "true" + else + echo "false" + fi +} + function tear_down_compass() { sudo virsh destroy compass > /dev/null 2>&1 sudo virsh undefine compass > /dev/null 2>&1 @@ -27,11 +47,11 @@ function install_compass_core() { } function set_compass_machine() { - local config_file=$WORK_DIR/installer/compass-docker-compose/group_vars/all + local config_file=$WORK_DIR/installer/docker-compose/group_vars/all sed -i '/pxe_boot_macs/d' $config_file echo "pxe_boot_macs: [${machines}]" >> $config_file - ansible-playbook $WORK_DIR/installer/compass-docker-compose/add_machine.yml + ansible-playbook $WORK_DIR/installer/docker-compose/add_machine.yml } function install_compass() { @@ -129,13 +149,9 @@ function wait_ok() { } function launch_compass() { - local group_vars=$WORK_DIR/installer/compass-docker-compose/group_vars/all + local group_vars=$WORK_DIR/installer/docker-compose/group_vars/all sed -i "s#^\(compass_dir:\).*#\1 $COMPASS_DIR#g" $group_vars - sed -i "s#^\(compass_deck:\).*#\1 $COMPASS_DECK#g" $group_vars - sed -i "s#^\(compass_tasks:\).*#\1 $COMPASS_TASKS#g" $group_vars - sed -i "s#^\(compass_cobbler:\).*#\1 $COMPASS_COBBLER#g" $group_vars - sed -i "s#^\(compass_db:\).*#\1 $COMPASS_DB#g" $group_vars - sed -i "s#^\(compass_mq:\).*#\1 $COMPASS_MQ#g" $group_vars + sed -i "s#^\(compose_images:\).*#\1 $COMPOSE_IMAGES#g" $group_vars if [[ $OFFLINE_DEPLOY == "Enable" ]]; then sed -i "s#.*\(compass_repo:\).*#\1 $COMPASS_REPO#g" $group_vars @@ -150,7 +166,7 @@ function launch_compass() { sed -i "s#^\(deck_port:\).*#\1 $COMPASS_DECK_PORT#g" $group_vars sed -i "s#^\(repo_port:\).*#\1 $COMPASS_REPO_PORT#g" $group_vars - ansible-playbook $WORK_DIR/installer/compass-docker-compose/bring_up_compass.yml + ansible-playbook $WORK_DIR/installer/docker-compose/bring_up_compass.yml } function recover_compass() { |