3 export OSA_PATH=/opt/openstack-ansible
4 export LOG_PATH=$OSA_PATH/log
5 export PLAYBOOK_PATH=$OSA_PATH/playbooks
6 export OSA_BRANCH=${OSA_BRANCH:-"master"}
8 JUMPHOST_IP="192.168.122.2"
10 sudo /bin/rm -rf $LOG_PATH
11 sudo /bin/mkdir -p $LOG_PATH
12 sudo /bin/cp /root/.ssh/id_rsa.pub ../file/authorized_keys
13 sudo echo -e '\n'>>../file/authorized_keys
16 # this will prepare the jump host
17 # git clone the Openstack-Ansible, bootstrap and configure network
18 sudo ansible-playbook -i inventory jumphost_configuration.yml -vvv
20 # this will prepare the target host
21 # such as configure network and NFS
22 sudo ansible-playbook -i inventory targethost_configuration.yml
24 # using OpenStack-Ansible deploy the OpenStack
27 sudo /bin/sh -c "ssh root@$JUMPHOST_IP openstack-ansible \
28 $PLAYBOOK_PATH/setup-hosts.yml" | \
29 tee $LOG_PATH/setup-host.log
31 #check the result of openstack-ansible setup-hosts.yml
32 #if failed, exit with exit code 1
33 grep "failed=1" $LOG_PATH/setup-host.log>/dev/null \
34 || grep "unreachable=1" $LOG_PATH/setup-host.log>/dev/null
36 echo "failed setup host!"
39 echo "setup host successfully!"
42 echo "Set UP Infrastructure !"
43 sudo /bin/sh -c "ssh root@$JUMPHOST_IP openstack-ansible \
44 $PLAYBOOK_PATH/setup-infrastructure.yml" | \
45 tee $LOG_PATH/setup-infrastructure.log
47 grep "failed=1" $LOG_PATH/setup-infrastructure.log>/dev/null \
48 || grep "unreachable=1" $LOG_PATH/setup-infrastructure.log>/dev/null
50 echo "failed setup infrastructure!"
53 echo "setup infrastructure successfully!"
56 sudo /bin/sh -c "ssh root@$JUMPHOST_IP ansible -i $PLAYBOOK_PATH/inventory/ \
57 galera_container -m shell \
58 -a "mysql -h localhost -e 'show status like \"%wsrep_cluster_%\";'"" \
59 | tee $LOG_PATH/galera.log
61 grep "FAILED" $LOG_PATH/galera.log>/dev/null
63 echo "failed verify the database cluster!"
66 echo "verify the database cluster successfully!"
69 echo "Set UP OpenStack !"
70 sudo /bin/sh -c "ssh root@$JUMPHOST_IP openstack-ansible \
71 $PLAYBOOK_PATH/setup-openstack.yml" | \
72 tee $LOG_PATH/setup-openstack.log
74 grep "failed=1" $LOG_PATH/setup-openstack.log>/dev/null \
75 || grep "unreachable=1" $LOG_PATH/setup-openstack.log>/dev/null
77 echo "failed setup openstack!"
80 echo "OpenStack successfully deployed!"