.travis.yml 1018 B

1234567891011121314151617181920212223242526272829303132333435
  1. ---
  2. language: python
  3. python: "2.7"
  4. env:
  5. - SITE=test.yml
  6. before_install:
  7. - sudo apt-get update -qq
  8. - sudo apt-get install -y curl
  9. install:
  10. # Install Ansible.
  11. - pip install ansible
  12. # Add ansible.cfg to pick up roles path.
  13. - "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
  14. script:
  15. # Check the role/playbook's syntax.
  16. - "ansible-playbook -i tests/inventory tests/$SITE --syntax-check"
  17. # Run the role/playbook with ansible-playbook.
  18. - "ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo"
  19. # Run the role/playbook again, checking to make sure it's idempotent.
  20. - >
  21. ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo
  22. | grep -q 'changed=0.*failed=0'
  23. && (echo 'Idempotence test: pass' && exit 0)
  24. || (echo 'Idempotence test: fail' && exit 1)
  25. # TODO - get the test working. Probably need to add a virtual host.
  26. # Request a page via Nginx, to make sure Nginx is running and responds.
  27. # - "curl http://localhost/"