-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
58 lines (47 loc) · 1.92 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
language: python
env:
- ANSIBLE_VERSION="2.8"
- ANSIBLE_VERSION="2.9"
python:
- 2.7
- 3.7
# Use the new container infrastructure
sudo: required
services:
- docker
before_install:
# Build CentOS image to verify ansible role there
- docker build --rm=true --tag=el-07 --file tests/docker/centos-07 .
- docker build --rm=true --tag=el-08 --file tests/docker/centos-08 .
# Build Debian images
- docker build --rm=true --tag=dn-09 --file tests/docker/debian-09 .
- docker build --rm=true --tag=dn-10 --file tests/docker/debian-10 .
install:
- pip install ansible==${ANSIBLE_VERSION} && ansible --version
- pip install ansible-lint yamllint
# Rename a target directory
- ln -sf -T $TRAVIS_BUILD_DIR $TRAVIS_BUILD_DIR/../collectd
# Create ansible.cfg with correct roles_path
- printf "[defaults]\nroles_path=$(dirname $TRAVIS_BUILD_DIR)\nhash_behaviour=merge" > ansible.cfg
script:
- set -e
- yamllint ./
- ansible-lint tests/test.yml
# Add container name in inventory file and check syntax of the playbook
- echo centos-07 >> tests/inventory
- echo centos-08 >> tests/inventory
- echo debian-09 >> tests/inventory
- echo debian-10 >> tests/inventory
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
# Run container with SSH server
- docker run -d --tmpfs /run --tmpfs /tmp --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro --name centos-07 el-07
- docker run -d --tmpfs /run --tmpfs /tmp --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro --name centos-08 el-08
- docker run -d --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro --name debian-09 dn-09
- docker run -d --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro --name debian-10 dn-10
# Run playbook
- ansible-playbook tests/test.yml -i tests/inventory --become
# Remove containers
- docker rm -f centos-07 centos-08 debian-09 debian-10
# notifications:
# webhooks: https://galaxy.ansible.com/api/v1/notifications/