You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
950 B

9 years ago
9 years ago
  1. sudo: required
  2. dist: trusty
  3. language: python
  4. python: "2.7"
  5. addons:
  6. hosts:
  7. - node1
  8. env:
  9. - SITE=cluster.yml ANSIBLE_VERSION=2.0.0
  10. install:
  11. # Install Ansible.
  12. - sudo -H pip install ansible==${ANSIBLE_VERSION}
  13. - sudo -H pip install netaddr
  14. cache:
  15. directories:
  16. - $HOME/releases
  17. - $HOME/.cache/pip
  18. before_script:
  19. - export PATH=$PATH:/usr/local/bin
  20. script:
  21. # Check the role/playbook's syntax.
  22. - "sudo -H ansible-playbook -i inventory/local-tests.cfg $SITE --syntax-check"
  23. # Run the role/playbook with ansible-playbook.
  24. - "sudo -H ansible-playbook -i inventory/local-tests.cfg $SITE --connection=local"
  25. # Run the role/playbook again, checking to make sure it's idempotent.
  26. - >
  27. sudo -H ansible-playbook -i inventory/local-tests.cfg $SITE --connection=local
  28. | tee /dev/stderr | grep -q 'changed=0.*failed=0'
  29. && (echo 'Idempotence test: pass' && exit 0)
  30. || (echo 'Idempotence test: fail' && exit 1)