forked from dev-sec/ansible-collection-hardening
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
56 lines (48 loc) · 1.54 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
---
services: docker
env:
global:
- version=latest
- init=/sbin/init
- run_opts="--cap-add SYS_ADMIN"
- volume="/sys/fs/cgroup:/sys/fs/cgroup:ro"
jobs:
- distro=centos6
volume=":"
run_opts=""
- distro=centos7
- distro=centos8
- distro=oracle6
volume=":"
run_opts=""
# - distro=oracle7
- distro=ubuntu1604
- distro=ubuntu1804
- distro=debian9
init=/lib/systemd/systemd
- distro=debian10
- distro=amazon
- distro=fedora
init=/lib/systemd/systemd
- distro=opensuse_tumbleweed
run_opts="--privileged"
- distro=arch
init=/usr/lib/systemd/systemd
run_opts="--privileged"
before_install:
# Pull container
- 'docker pull rndmh3ro/docker-${distro}-ansible:${version}'
script:
- pip install --user ansible-lint
- ansible-lint ./
- container_id=$(mktemp)
# Run container in detached state.
- 'docker run --detach --volume="${volume}" --volume="${PWD}":/etc/ansible/roles/ansible-os-hardening:ro ${run_opts} rndmh3ro/docker-${distro}-ansible:${version} "${init}" > "${container_id}"'
# Output Ansible version from docker image
- 'docker exec "$(cat ${container_id})" ansible-playbook --version'
# Test role.
- 'docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/ansible-os-hardening/tests/test.yml --diff'
# Verify role
- 'inspec exec https://github.com/dev-sec/linux-baseline/ -t docker://$(cat ${container_id}) --no-distinct-exit'
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/