- hosts: all tasks: # Borrowed from devstack tasks but we want it early. - name: Ensure {{ ansible_user_dir }}/logs exists become: true file: path: "{{ ansible_user_dir }}/logs" state: directory owner: "{{ ansible_user }}" - name: start placement args: chdir: "{{ ansible_user_dir }}/src/git.openstack.org/openstack/placement" shell: executable: /bin/bash cmd: | set -x # TODO(cdent): Presumably ansible can do this, perhaps with 'package'. # create database sudo debconf-set-selections <&1 | tee -a $LOG rp_count=$(curl -H 'x-auth-token: admin' $placement_url/resource_providers |json_pp|grep -c '"name"') # Skip curl and note if we failed to create the required number of rps if [[ $rp_count -ge $COUNT ]]; then ( echo "##### TIMING GET /allocation_candidates?${PLACEMENT_QUERY} twice" time curl -s -H 'x-auth-token: admin' -H 'openstack-api-version: placement 1.21' "$placement_url/allocation_candidates?${PLACEMENT_QUERY}" > /dev/null time curl -s -H 'x-auth-token: admin' -H 'openstack-api-version: placement 1.21' "$placement_url/allocation_candidates?${PLACEMENT_QUERY}" > /dev/null ) 2>&1 | tee -a $LOG else ( echo "Unable to create expected number of resource providers. Expected: ${COUNT}, Got: $rp_count" echo "See job-output.txt.gz and logs/screen-placement-api.txt.gz for additional detail." ) | tee -a $LOG code=1 fi set -x deactivate exit $code } check_placement