-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
30 lines (27 loc) · 1.07 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
language: python
python: "2.7"
sudo: required
services:
- docker
before_install:
- sudo apt-get update -qq
install:
- pip install ansible
- printf "[defaults]\nroles_path = ../" > ansible.cfg
- docker run --name travis-trusty --privileged -d dpujadas/baseimage:trusty
- docker run --name travis-xenial --privileged -d dpujadas/baseimage:xenial
script:
# Check the syntax
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
# Check role success
- ansible-playbook tests/test.yml -i tests/inventory
# Check idempotence
- >
ansible-playbook tests/test.yml -i tests/inventory | tee /tmp/output.txt;
(grep -q 'travis-trusty.*changed=0.*failed=0' /tmp/output.txt &&
grep -q 'travis-xenial.*changed=0.*failed=0' /tmp/output.txt)
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Check apache is up and running
- curl http://$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' travis-trusty)
- curl http://$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' travis-xenial)