---
language: python
python: "2.7"


before_install:
  # Make sure everything's up to date.
  - sudo apt-get install -y python-software-properties
  - sudo add-apt-repository -y cloud-archive:kilo
  - sudo apt-get update -qq


install:
  # Install Ansible.
  - pip install ansible
  # Install Keystone client
  - sudo apt-get install -y python-keystoneclient

  # Add ansible.cfg to pick up roles path.
  - "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"


script:
  # Check the role/playbook's syntax.
  - ansible-playbook -i tests/inventory tests/test.yml --syntax-check

  # Run the role/playbook with ansible-playbook.
  - >
    ansible-playbook -i tests/inventory tests/test.yml --connection=local
    --sudo

  # Test role idempotency
  - >
    ansible-playbook -i tests/inventory tests/test.yml --connection=local
    --sudo | grep -q 'changed=0.*failed=0'
    && (echo 'Idempotence test: pass' && exit 0)
    || (echo 'Idempotence test: fail' && exit 1)

  # Test Keystone setup
  - >
    keystone --os-token 'os token' --os-endpoint http://localhost:35357/v2.0
    service-list | grep keystone

  - >
    keystone --os-token 'os token' --os-endpoint http://localhost:35357/v2.0
    endpoint-list

---
language: python
python: "2.7"
sudo: required
dist: trusty

before_install:
  # Make sure everything's up to date.
  - sudo apt-get install -y python-software-properties
  - sudo add-apt-repository -y cloud-archive:kilo
  - sudo apt-get update -qq


install:
  # Install Ansible.
  - pip install ansible
  # Install Keystone client
  - sudo apt-get install -y python-keystoneclient

  # Add ansible.cfg to pick up roles path.
  - "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"


script:
  # Check the role/playbook's syntax.
  - ansible-playbook -i tests/inventory tests/test.yml --syntax-check

  # Run the role/playbook with ansible-playbook.
  - >
    ansible-playbook -i tests/inventory tests/test.yml --connection=local
    --sudo

  # Test role idempotency
  - >
    ansible-playbook -i tests/inventory tests/test.yml --connection=local
    --sudo | grep -q 'changed=0.*failed=0'
    && (echo 'Idempotence test: pass' && exit 0)
    || (echo 'Idempotence test: fail' && exit 1)

  # Test Keystone setup
  - >
    keystone --os-token 'os token' --os-endpoint http://localhost:35357/v2.0
    service-list | grep keystone

  - >
    keystone --os-token 'os token' --os-endpoint http://localhost:35357/v2.0
    endpoint-list

Change to trusty beta image
Change to trusty beta image
