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.

39 lines
993 B

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