2015-12-12 11:17:40 +01:00
|
|
|
sudo: required
|
2014-04-22 14:39:07 +02:00
|
|
|
env:
|
2015-12-12 11:17:40 +01:00
|
|
|
- CONTAINER_ID=$(mktemp)
|
2014-04-23 19:59:07 +02:00
|
|
|
|
2015-12-12 11:17:40 +01:00
|
|
|
services:
|
|
|
|
- docker
|
2014-04-23 19:59:07 +02:00
|
|
|
|
2015-12-12 11:17:40 +01:00
|
|
|
before_install:
|
|
|
|
- sudo apt-get update
|
|
|
|
# Pull containers
|
|
|
|
- sudo docker pull centos:7
|
|
|
|
- sudo docker pull ubuntu:14.04
|
|
|
|
# Customize containers
|
2015-12-12 11:20:32 +01:00
|
|
|
- sudo docker build --rm=true --file=tests/Dockerfile.centos --tag=centos:ansible tests
|
|
|
|
- sudo docker build --rm=true --file=tests/Dockerfile.ubuntu --tag=ubuntu:ansible tests
|
2014-04-23 19:59:07 +02:00
|
|
|
|
2014-04-22 14:39:07 +02:00
|
|
|
script:
|
2015-12-12 11:17:40 +01:00
|
|
|
#
|
|
|
|
# Run test playbook on Ubuntu container
|
|
|
|
#
|
|
|
|
- sudo docker run ubuntu:ansible ansible-playbook /etc/ansible/test.yml --syntax-check
|
|
|
|
- sudo docker run ubuntu:ansible ansible-playbook /etc/ansible/test.yml
|
|
|
|
|
|
|
|
#
|
|
|
|
# Run test playbook on CentOS container
|
|
|
|
#
|
|
|
|
|
|
|
|
# Run container in detached state
|
|
|
|
- sudo docker run --detach --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro centos:ansible /usr/lib/systemd/systemd > "${CONTAINER_ID}"
|
|
|
|
|
|
|
|
- sudo docker exec "$(cat ${CONTAINER_ID})" ansible-playbook /etc/ansible/test.yml --syntax-check
|
|
|
|
- sudo docker exec "$(cat ${CONTAINER_ID})" ansible-playbook /etc/ansible/test.yml
|
|
|
|
# Clean up
|
|
|
|
- sudo docker stop "$(cat ${CONTAINER_ID})"
|
|
|
|
|
|
|
|
notifications:
|
|
|
|
email: false
|