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.

41 lines
953 B

  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
  10. before_install:
  11. - sudo apt-get update -qq
  12. install:
  13. # Install Ansible.
  14. - sudo -H pip install ansible
  15. - sudo -H pip install netaddr
  16. cache:
  17. directories:
  18. - $HOME/releases
  19. - $HOME/.cache/pip
  20. before_script:
  21. - export PATH=$PATH:/usr/local/bin
  22. script:
  23. # Check the role/playbook's syntax.
  24. - "sudo -H ansible-playbook -i inventory/local-tests.cfg $SITE --syntax-check"
  25. # Run the role/playbook with ansible-playbook.
  26. - "sudo -H ansible-playbook -i inventory/local-tests.cfg $SITE --connection=local"
  27. # Run the role/playbook again, checking to make sure it's idempotent.
  28. - >
  29. sudo -H ansible-playbook -i inventory/local-tests.cfg $SITE --connection=local
  30. | tee /dev/stderr | grep -q 'changed=0.*failed=0'
  31. && (echo 'Idempotence test: pass' && exit 0)
  32. || (echo 'Idempotence test: fail' && exit 1)