---
# Provision instance then install and run Contrail

- include_tasks: provision-instance.yml
- include_tasks: install-contrail.yml

- name: Wait for Contrail API to come up
  uri:
    url: "http://{{ hostvars['controller'].ansible_default_ipv4.address }}:8082/projects"
    status_code:
      - 200
      - 304
    validate_certs: no
  register: result
  until: result.status == 200 or result.status == 304
  retries: 30
  delay: 5

- name: Run contrail-status
  shell: |
    contrail-status
  become: yes
  ignore_errors: yes
  args:
    executable: /bin/bash

- name: Ensure ansible version
  shell: |
    ansible --version
  ignore_errors: yes
  args:
    executable: /bin/bash
