-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.yml
32 lines (27 loc) · 1.73 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
31
32
---
sudo: required
env:
- distribution: ubuntu
version: xenial
- distribution: ubuntu
version: trusty
services:
- docker
before_install:
- 'sudo docker pull ${distribution}:${version}'
# - 'sudo docker build --no-cache --rm --file=travis/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible travis'
script:
- container_id=$(mktemp)
- 'sudo docker run --detach -it --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --volume="${PWD}":/etc/ansible/roles/ansible-krb5-server:ro ${distribution}:${version} > "${container_id}"'
- 'sudo docker ps -a'
- 'sudo docker exec "$(cat ${container_id})" bash -c "apt-get update && apt-get dist-upgrade -y && apt-get install -y software-properties-common && rm -rf /var/lib/apt/lists/*"'
- 'sudo docker exec "$(cat ${container_id})" bash -c "apt-add-repository -y ppa:ansible/ansible && apt-get update && apt-get install -y git ansible && rm -rf /var/lib/apt/lists/*"'
- 'sudo docker exec "$(cat ${container_id})" bash -c "echo -e \"[local]\nlocalhost ansible_connection=local\" > /etc/ansible/hosts"'
- 'sudo docker exec "$(cat ${container_id})" bash -c "env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/ansible-krb5-server/tests/test.yml --syntax-check"'
- 'sudo docker exec "$(cat ${container_id})" bash -c "env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/ansible-krb5-server/tests/test.yml"'
- >
sudo docker exec "$(cat ${container_id})" bash -c "env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/ansible-krb5-server/tests/test.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)"
- 'sudo docker rm -f "$(cat ${container_id})"'