4 # Author: Serena Feng (feng.xiaoewi@zte.com.cn)
5 # Update testapi on remote server using ansible playbook automatically
8 # All rights reserved. This program and the accompanying materials
9 # are made available under the terms of the Apache License, Version 2.0
10 # which accompanies this distribution, and is available at
11 # http://www.apache.org/licenses/LICENSE-2.0
16 usage="Script to trigger update automatically.
19 bash $(basename "$0") [-h|--help] [-h <host>] [-u username] [-i identityfile] [-e|--execute]
22 -h|--help show this help text
23 -r|--remote remote server
24 -u|--user ssh username used to access to remote server
25 -i|--identity ssh PublicKey file used to access to remote server
26 -e|--execute execute update, if not set just check the ansible connectivity"
28 remote=testresults.opnfv.org
30 identity=~/.ssh/id_rsa
64 shift # past argument or value
69 echo "add authentication"
72 echo "test ansible connectivity"
73 ansible -i ./hosts $remote -m ping -u $user
75 echo "test playbook connectivity"
76 ansible-playbook -i $hosts test.yml -e "host=$remote user=$user"
78 if [ $execute == true ]; then
80 ansible-playbook -i $hosts update.yml -e "host=$remote \
84 update_path=/home/$user/testapi \
85 mongodb_url=mongodb://172.17.0.1:27017 \
86 swagger_url=http://testresults.opnfv.org/test"