---
language: python
python: "2.7"

sudo: required

services:
  - docker

# Install ansible
addons:
  apt:
    packages:
      - python-pip

install:
  # Install ansible
  - pip install ansible==2.5.6 setuptools==32.3.1 docker-py==1.10.6 yamllint==1.11.1

  # Create ansible.cfg with correct roles_path
  - printf '[defaults]\nroles_path=../\nhost_key_checking = False' >ansible.cfg

script:
  # Lint YAML files
  - yamllint .

  # Basic role syntax check
  - ansible-playbook tests/test.yml -i tests/travis.hosts --syntax-check --connection=local
  - ansible-playbook tests/test.yml -i tests/travis.hosts --check --connection=local

  # Run role
  - ansible-playbook tests/test.yml -i tests/travis.hosts --connection=local
  # Check if container running
  - docker inspect nginx | grep -q "Status.*running"
  # Check if container returning statis response
  - curl "http://localhost/" | grep -q "Container working"
  # Check if container serve files
  - curl "http://localhost/hello" | grep -q "Container working"

  # Run Idempotent test
  - ansible-playbook tests/test.yml -i tests/travis.hosts --connection=local | grep -q 'changed=0.*failed=0'

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

---
language: python
python: "2.7"

sudo: required

services:
  - docker

# Install ansible
addons:
  apt:
    packages:
      - python-pip

install:
  # Install ansible
  - pip install ansible==2.5.6
  - pip install setuptools==32.3.1
  - pip install docker-py==1.10.6
  - pip install yamllint==1.11.1

  # Create ansible.cfg with correct roles_path
  - printf '[defaults]\nroles_path=../\nhost_key_checking = False' >ansible.cfg

script:
  # Lint YAML files
  - yamllint .

  # Basic role syntax check
  - ansible-playbook tests/test.yml -i tests/travis.hosts --syntax-check --connection=local
  - ansible-playbook tests/test.yml -i tests/travis.hosts --check --connection=local

  # Run role
  - ansible-playbook tests/test.yml -i tests/travis.hosts --connection=local
  # Check if container running
  - docker inspect nginx | grep -q "Status.*running"
  # Check if container returning statis response
  - curl "http://localhost/" | grep -q "Container working"
  # Check if container serve files
  - curl "http://localhost/hello" | grep -q "Container working"

  # Run Idempotent test
  - ansible-playbook tests/test.yml -i tests/travis.hosts --connection=local | grep -q 'changed=0.*failed=0'

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

Install tools on separate lines
Install tools on separate lines
