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.

42 lines
1.0 KiB

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