env:
  - PLATFORM='docker-jessie-default-mysql-master'      ANSIBLE_VERSION='ansible>=2.3,<2.4'
  - PLATFORM='docker-jessie-default-mariadb-master'    ANSIBLE_VERSION='ansible>=2.3,<2.4'
  - PLATFORM='docker-jessie-upstream-mariadb-master'   ANSIBLE_VERSION='ansible>=2.3,<2.4'
  - PLATFORM='docker-jessie-upstream-percona-master'   ANSIBLE_VERSION='ansible>=2.3,<2.4'
  - PLATFORM='docker-jessie-upstream-mariadbgalera-1'  ANSIBLE_VERSION='ansible>=2.3,<2.4'
  - PLATFORM='docker-stretch-default-mysql-master'     ANSIBLE_VERSION='ansible>=2.3,<2.4'
  - PLATFORM='docker-stretch-default-mariadb-master'   ANSIBLE_VERSION='ansible>=2.3,<2.4'
  - PLATFORM='docker-stretch-upstream-mariadb-master'  ANSIBLE_VERSION='ansible>=2.3,<2.4'
  - PLATFORM='docker-stretch-upstream-mariadbgalera-1' ANSIBLE_VERSION='ansible>=2.3,<2.4'

matrix:
  allow_failures:
    - env: PLATFORM='docker-jessie-upstream-mariadbgalera-1'  ANSIBLE_VERSION='ansible>=2.3,<2.4'
    - env: PLATFORM='docker-stretch-upstream-mariadbgalera-1' ANSIBLE_VERSION='ansible>=2.3,<2.4'
  fast_finish: true

sudo: required

dist: trusty

language: python

services:
  - docker

before_install:
  - wget https://releases.hashicorp.com/vagrant/2.0.1/vagrant_2.0.1_x86_64.deb
  - sudo dpkg -i vagrant_2.0.1_x86_64.deb
  - vagrant plugin install vagrant-hostmanager 

install:
  - pip install "$ANSIBLE_VERSION"

script:
  - VAGRANT_DEFAULT_PROVIDER=docker vagrant up $PLATFORM
  - >
    VAGRANT_DEFAULT_PROVIDER=docker vagrant provision $PLATFORM
    | grep -q 'changed=0.*failed=0'
    && (echo 'Idempotence test: pass' && exit 0)
    || (echo 'Idempotence test: fail' && exit 1)
  - VAGRANT_DEFAULT_PROVIDER=docker vagrant status

notifications:
  webhooks: https://galaxy.ansible.com/api/v1/notifications/