diff options
Diffstat (limited to 'deployed-server/scripts')
-rwxr-xr-x | deployed-server/scripts/get-occ-config.sh | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/deployed-server/scripts/get-occ-config.sh b/deployed-server/scripts/get-occ-config.sh index 2c01174e..404244b1 100755 --- a/deployed-server/scripts/get-occ-config.sh +++ b/deployed-server/scripts/get-occ-config.sh @@ -11,28 +11,36 @@ OBJECTSTORAGE_HOSTS=${OBJECTSTORAGE_HOSTS:-""} CEPHSTORAGE_HOSTS=${CEPHSTORAGE_HOSTS:-""} SUBNODES_SSH_KEY=${SUBNODES_SSH_KEY:-"~/.ssh/id_rsa"} SSH_OPTIONS="-tt -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=Verbose -o PasswordAuthentication=no -o ConnectionAttempts=32" +OVERCLOUD_ROLES=${OVERCLOUD_ROLES:-"Controller Compute BlockStorage ObjectStorage CephStorage"} + +# Set the _hosts vars for the default roles based on the old var names that +# were all caps for backwards compatibility. +Controller_hosts=${Controller_hosts:-"$CONTROLLER_HOSTS"} +Compute_hosts=${Compute_hosts:-"$COMPUTE_HOSTS"} +BlockStorage_hosts=${BlockStorage_hosts:-"$BLOCKSTORAGE_HOSTS"} +ObjectStorage_hosts=${ObjectStorage_hosts:-"$OBJECTSTORAGE_HOSTS"} +CephStorage_hosts=${CephStorage_hosts:-"$CEPHSTORAGE_HOSTS"} + +# Set the _hosts_a vars for each role defined +for role in $OVERCLOUD_ROLES; do + eval hosts=\${${role}_hosts} + read -a ${role}_hosts_a <<< $hosts +done -read -a Controller_hosts_a <<< $CONTROLLER_HOSTS -read -a Compute_hosts_a <<< $COMPUTE_HOSTS -read -a BlockStorage_hosts_a <<< $BLOCKSTORAGE_HOSTS -read -a ObjectStorage_hosts_a <<< $OBJECTSTORAGE_HOSTS -read -a CephStorage_hosts_a <<< $CEPHSTORAGE_HOSTS - -roles="Controller Compute BlockStorage ObjectStorage CephStorage" admin_user_id=$(openstack user show admin -c id -f value) admin_project_id=$(openstack project show admin -c id -f value) function check_stack { - local stack_to_check=$1 + local stack_to_check=${1:-""} - if [ "$stack_to_check" = "|" ]; then + if [ "$stack_to_check" = "" ]; then echo Stack not created return 1 fi echo Checking if $1 stack is created set +e - heat resource-list $stack_to_check + openstack stack resource list $stack_to_check rc=$? set -e @@ -44,18 +52,18 @@ function check_stack { } -for role in $roles; do +for role in $OVERCLOUD_ROLES; do while ! check_stack overcloud; do sleep $SLEEP_TIME done - rg_stack=$(heat resource-list overcloud | grep " $role " | awk '{print $4}') + rg_stack=$(openstack stack resource show overcloud $role -c physical_resource_id -f value) while ! check_stack $rg_stack; do sleep $SLEEP_TIME - rg_stack=$(heat resource-list overcloud | grep " $role " | awk '{print $4}') + rg_stack=$(openstack stack resource show overcloud $role -c physical_resource_id -f value) done - stacks=$(heat resource-list $rg_stack | grep OS::TripleO::$role | awk '{print $4}') + stacks=$(openstack stack resource list $rg_stack -c physical_resource_id -f value) i=0 @@ -65,30 +73,25 @@ for role in $roles; do server_resource_name="NovaCompute" fi - server_stack=$(heat resource-list $stack | grep " $server_resource_name " | awk '{print $4}') + server_stack=$(openstack stack resource show $stack $server_resource_name -c physical_resource_id -f value) while ! check_stack $server_stack; do sleep $SLEEP_TIME - server_stack=$(heat resource-list $stack | grep " $server_resource_name " | awk '{print $4}') + server_stack=$(openstack stack resource show $stack $server_resource_name -c physical_resource_id -f value) done - deployed_server_stack=$(heat resource-list $server_stack | grep "deployed-server" | awk '{print $4}') + deployed_server_metadata_url=$(openstack stack resource metadata $server_stack deployed-server | jq -r '.["os-collect-config"].request.metadata_url') echo "======================" echo "$role$i os-collect-config.conf configuration:" config=" [DEFAULT] -collectors=heat +collectors=request command=os-refresh-config polling_interval=30 -[heat] -user_id=$admin_user_id -password=$OS_PASSWORD -auth_url=$OS_AUTH_URL -project_id=$admin_project_id -stack_id=$deployed_server_stack -resource_name=deployed-server-config" +[request] +metadata_url=$deployed_server_metadata_url" echo "$config" echo "======================" |