public-health-ch/ansible/roles/dev-sec.os-hardening/.travis.yml

86 lines
2.6 KiB
YAML
Raw Normal View History

2017-04-24 12:22:51 +00:00
---
services: docker
env:
- distro: centos6
version: latest
init: /sbin/init
- distro: centos7
2018-12-17 12:50:15 +00:00
init: /lib/systemd/systemd
2017-04-24 12:22:51 +00:00
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
version: latest
2020-05-15 20:41:39 +00:00
- distro: centos8
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
version: latest
- distro: fedora
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
version: latest
2017-04-24 12:22:51 +00:00
- distro: oracle6
version: latest
init: /sbin/init
2018-12-17 12:50:15 +00:00
# - distro: oracle7
# init: /lib/systemd/systemd
# run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
# version: latest
2017-04-24 12:22:51 +00:00
- distro: ubuntu1604
version: latest
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
2018-12-17 12:50:15 +00:00
- distro: ubuntu1804
2017-04-24 12:22:51 +00:00
version: latest
2018-12-17 12:50:15 +00:00
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
2017-04-24 12:22:51 +00:00
2020-05-15 20:41:39 +00:00
- distro: debian9
2017-04-24 12:22:51 +00:00
version: latest
2020-05-15 20:41:39 +00:00
init: /lib/systemd/systemd
2018-12-17 12:50:15 +00:00
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
2017-04-24 12:22:51 +00:00
2020-05-15 20:41:39 +00:00
- distro: debian10
2017-04-24 12:22:51 +00:00
version: latest
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
2018-12-17 12:50:15 +00:00
- distro: amazon
init: /lib/systemd/systemd
version: latest
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
2020-05-15 20:41:39 +00:00
# - distro: opensuse_tumbleweed
# init: /usr/lib/systemd/systemd
# version: latest
# run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro --volume=/run:/run:ro"
2017-04-24 12:22:51 +00:00
before_install:
# Pull container
- 'docker pull rndmh3ro/docker-${distro}-ansible:${version}'
script:
2020-05-15 20:41:39 +00:00
- pip install --user ansible-lint
- ansible-lint ./
2017-04-24 12:22:51 +00:00
- container_id=$(mktemp)
# Run container in detached state.
- 'docker run --detach --volume="${PWD}":/etc/ansible/roles/ansible-os-hardening:ro ${run_opts} rndmh3ro/docker-${distro}-ansible:${version} "${init}" > "${container_id}"'
2020-05-15 20:41:39 +00:00
# Output Ansible version from docker image
- 'docker exec "$(cat ${container_id})" ansible-playbook --version'
2018-12-17 12:50:15 +00:00
# Test role.
2020-05-15 20:41:39 +00:00
- 'docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/ansible-os-hardening/tests/test.yml --diff'
2017-04-24 12:22:51 +00:00
2018-12-17 12:50:15 +00:00
# Verify role
- 'inspec exec https://github.com/dev-sec/linux-baseline/ -t docker://$(cat ${container_id}) --controls=os-01 os-02 os-03 os-04 os-05 os-05b os-06 os-07 os-09 os-10 os-11 package-01 package-02 package-03 package-05 package-06 package-08 package-09 --no-distinct-exit'
2017-04-24 12:22:51 +00:00
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/