2015-01-12 22:01:08 +01:00
|
|
|
---
|
|
|
|
language: python
|
|
|
|
python: "2.7"
|
|
|
|
|
|
|
|
before_install:
|
|
|
|
# Make sure everything's up to date.
|
|
|
|
- sudo apt-get update -qq
|
|
|
|
|
|
|
|
install:
|
|
|
|
# Install Ansible.
|
|
|
|
- pip install ansible
|
|
|
|
|
|
|
|
# Add ansible.cfg to pick up roles path.
|
2015-01-12 22:12:32 +01:00
|
|
|
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
|
|
|
|
|
2015-01-12 22:01:08 +01:00
|
|
|
|
|
|
|
script:
|
|
|
|
# Check the roles syntax
|
|
|
|
- "ansible-playbook -i tests/inventory tests/test.yml --syntax-check"
|
|
|
|
|
2015-01-12 22:12:32 +01:00
|
|
|
# Run the role
|
|
|
|
- "ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo"
|
2015-01-12 22:01:08 +01:00
|
|
|
|
2015-01-12 22:12:32 +01:00
|
|
|
# Run the role/playbook again, checking to make sure it's idempotent.
|
|
|
|
- >
|
2015-01-12 22:20:19 +01:00
|
|
|
ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo
|
2015-01-12 22:12:32 +01:00
|
|
|
| grep -q 'changed=0.*failed=0'
|
|
|
|
&& (echo 'Idempotence test: pass' && exit 0)
|
|
|
|
|| (echo 'Idempotence test: fail' && exit 1)
|