--- # Copyright 2019, VEXXHOST, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - hosts: localhost gather_facts: false tasks: - name: Get authentication token os_auth: cloud: default - name: Set facts for placement URL set_fact: placement_token: "{{ auth_token }}" placement_url: "{{ service_catalog | json_query('[?name==`placement`].endpoints | [0][?interface==`public`].url | [0]') }}" - name: Run simple placement request register: placement_request uri: url: "{{ placement_url }}/resource_providers" headers: X-Auth-Token: "{{ placement_token }}" - name: Log the HTTP request debug: var: placement_request - name: Assert response is valid assert: that: - placement_request.status == 200 - placement_request.json.resource_providers == [] vars: ansible_python_interpreter: "{{ ansible_playbook_python }}"