---
language: python
python: "2.7"

before_install:
  # Make sure everything's up to date.
  - sudo apt-get update -qq

install:
  # Install Ansible.
  - pip install ansible

  # Add ansible.cfg to pick up roles path. and inventory file
  - echo -e '[defaults]\nroles_path = ../' > ansible.cfg
  - echo 'localhost  ansible_connection=local' > tests/local.ini

script:
    # 1st: check syntax
    - echo "***************************** SYNTAX CHECK (1) *****************************"
    - ansible-playbook -i tests/local.ini tests/test1.yml --syntax-check
    # 2nd:  Make sure we run the entire playbook
    - echo "***************************** RUN PLAY (2) *****************************"    
    - ansible-playbook -i tests/local.ini tests/test1.yml --sudo -vvvv
    # 3rd:  Make sure our playbook is idempotent 
    - echo "***************************** Idempotence test (3) *****************************"     
    - >
      ansible-playbook -i tests/local.ini tests/test1.yml --sudo -vvvv | tee ansible_output  
      | grep -q 'changed=0.*failed=0'
      && (echo 'Idempotence test: pass' && cat ansible_output && exit 0)
      || (echo 'Idempotence test: fail' && exit 1)
    # 4th:  Application test (TODO)
    #- ./tests/test_logs.sh

---
language: python
python: "2.7"

before_install:
  # Make sure everything's up to date.
  - sudo apt-get update -qq

install:
  # Install Ansible.
  - pip install ansible

  # Add ansible.cfg to pick up roles path. and inventory file
  - echo -e '[defaults]\nroles_path = ../' > ansible.cfg
  - echo 'localhost  ansible_connection=local' > tests/local.ini

script:
    # 1st: check syntax
    - echo "***************************** SYNTAX CHECK (1) *****************************"
    - ansible-playbook -i tests/local.ini tests/test1.yml --syntax-check
    # 2nd:  Make sure we run the entire playbook
    - echo "***************************** RUN PLAY (2) *****************************"    
    - ansible-playbook -i tests/local.ini tests/test1.yml --sudo -vvvv
    # 3rd:  Make sure our playbook is idempotent 
    - echo "***************************** Idempotence test (3) *****************************"     
    - >
      ansible-playbook -i tests/local.ini tests/test1.yml --sudo -vvvv | tee ansible_output  
      | grep -q 'changed=0.*failed=0'
      && (echo 'Idempotence test: pass' && exit 0)
      || (echo 'Idempotence test: fail' && cat ansible_output && exit 1)
    # 4th:  Application test (TODO)
    #- ./tests/test_logs.sh

Fix preview in the right condition :D
Fix preview in the right condition :D