#!/bin/bash
MAIN_ADD_HOST=#!/bin/bash
MAIN_ADD_HOST=$1
create_host(){
echo 'create host ok'
}
deploy_service(){
ADD_HOST_PORT='8080'
}
deploy_code(){
echo 'deploy code ok'
}
service_check(){
STATUS=$(curl -s --head https://"$ADD_HOST":"$ADD_HOST_PORT"/ |grep "200 OK")
if [ -n "$STATUS" ];then
echo 'status check ok'
else
echo 'status check not ok'
exit
fi
}
etcd_key(){
ADD_HOST=$1
curl http://192.168.3.12:2379/v2/keys/salt/haproxy/backend_www_chinasoft_com/$ADD_HOST -XPUT -d value="192.168.3.19:${ADD_HOST_PORT}"
}
sync_state(){
salt '*' state.sls cluster.haproxy-outside env=prod
}
main(){
create_host;
deploy_service;
deploy_code;
etcd_key $MAIN_ADD_HOST;
sync_state;
}
main $1
create_host(){
echo 'create host okcre