1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_ntp.git synced 2024-08-16 12:59:49 +02:00
ansible_role_ntp/.travis.yml

126 lines
2.9 KiB
YAML
Raw Normal View History

2018-12-28 11:15:32 +01:00
---
services:
- docker
env:
#-----------------------------------------------
#
# CentOS
#
#-----------------------------------------------
- distribution: centos
version: "7"
- distribution: centos
version: "6"
#--------------------------------
#
# Fedora
#
#--------------------------------
- distribution: fedora
version: "28"
- distribution: fedora
version: "27"
playbook: default.yml
- distribution: fedora
version: "26"
#--------------------------------
#
# Ubuntu
#
#--------------------------------
- distribution: ubuntu
version: "18.04"
- distribution: ubuntu
version: "17.10"
- distribution: ubuntu
version: "16.04"
- distribution: ubuntu
version: "14.04"
- distribution: ubuntu
version: "12.04"
#--------------------------------
#
# Debian
#
#--------------------------------
- distribution: debian
version: "9"
- distribution: debian
version: "8"
- distribution: debian
version: "7"
#--------------------------------
#
# Oraclelinux
#
#--------------------------------
- distribution: oraclelinux
version: "7"
- distribution: oraclelinux
version: "6"
#--------------------------------
#
# Amazonlinux
#
#--------------------------------
- distribution: amazonlinux
version: "2"
- distribution: amazonlinux
version: "1"
#--------------------------------
#
# Opensuse
#
#--------------------------------
- distribution: opensuse
version: "42.3"
- distribution: opensuse
version: "42.2"
- distribution: opensuse
version: "13.2"
#--------------------------------
#
# Archlinux
#
#--------------------------------
- distribution: archlinux
version: "rolling"
before_install:
# Build docker container
- 'sudo docker pull diodonfrost/${distribution}-${version}-ansible:latest'
script:
- container_id=$(mktemp)
# Run container and mount ansible role with it
- 'sudo docker run --detach --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --volume="${PWD}":/etc/ansible/roles/ansible-role-ntp:ro diodonfrost/${distribution}-${version}-ansible:latest > "${container_id}"'
# Check syntax
- 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/ansible-role-ntp/tests/test.yml --syntax-check'
# Run ansible playbook
- 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/ansible-role-ntp/tests/test.yml'
# Test indempotence
- >
sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/ansible-role-ntp/tests/test.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Test role
- 'inspec exec tests/inspec -t docker://$(cat ${container_id})'
# Delete container
- 'sudo docker rm -f "$(cat ${container_id})"'
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/