2015-12-22 18:50:55 +08:00
|
|
|
sudo: required
|
|
|
|
dist: trusty
|
|
|
|
language: python
|
|
|
|
python: "2.7"
|
|
|
|
|
|
|
|
addons:
|
|
|
|
hosts:
|
|
|
|
- node1
|
|
|
|
|
|
|
|
env:
|
2016-01-13 00:56:29 +08:00
|
|
|
- SITE=cluster.yml ANSIBLE_VERSION=2.0.0
|
|
|
|
- SITE=cluster.yml ANSIBLE_VERSION=1.9.4
|
2015-12-22 18:50:55 +08:00
|
|
|
|
|
|
|
before_install:
|
|
|
|
- sudo apt-get update -qq
|
|
|
|
|
|
|
|
install:
|
|
|
|
# Install Ansible.
|
2016-01-13 00:56:29 +08:00
|
|
|
- sudo -H pip install ansible==${ANSIBLE_VERSION}
|
2015-12-22 18:50:55 +08:00
|
|
|
- sudo -H pip install netaddr
|
|
|
|
|
|
|
|
cache:
|
|
|
|
directories:
|
|
|
|
- $HOME/releases
|
|
|
|
- $HOME/.cache/pip
|
|
|
|
|
|
|
|
before_script:
|
|
|
|
- export PATH=$PATH:/usr/local/bin
|
|
|
|
|
|
|
|
script:
|
|
|
|
# Check the role/playbook's syntax.
|
|
|
|
- "sudo -H ansible-playbook -i inventory/local-tests.cfg $SITE --syntax-check"
|
|
|
|
|
|
|
|
# Run the role/playbook with ansible-playbook.
|
|
|
|
- "sudo -H ansible-playbook -i inventory/local-tests.cfg $SITE --connection=local"
|
|
|
|
|
|
|
|
# Run the role/playbook again, checking to make sure it's idempotent.
|
|
|
|
- >
|
|
|
|
sudo -H ansible-playbook -i inventory/local-tests.cfg $SITE --connection=local
|
|
|
|
| tee /dev/stderr | grep -q 'changed=0.*failed=0'
|
|
|
|
&& (echo 'Idempotence test: pass' && exit 0)
|
|
|
|
|| (echo 'Idempotence test: fail' && exit 1)
|