mirror of
https://github.com/dev-sec/ansible-collection-hardening
synced 2024-11-14 02:47:06 +00:00
6b42f12434
Signed-off-by: Sebastian Gumprich <github@gumpri.ch>
79 lines
2.5 KiB
YAML
79 lines
2.5 KiB
YAML
---
|
|
services: docker
|
|
|
|
env:
|
|
- distro: centos6
|
|
version: latest
|
|
init: /sbin/init
|
|
|
|
- distro: centos7
|
|
init: /lib/systemd/systemd
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
|
version: latest
|
|
|
|
- distro: oracle6
|
|
version: latest
|
|
init: /sbin/init
|
|
|
|
- distro: oracle7
|
|
init: /lib/systemd/systemd
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
|
|
|
- distro: ubuntu1604
|
|
version: latest
|
|
init: /lib/systemd/systemd
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
|
|
|
- distro: ubuntu1804
|
|
version: latest
|
|
init: /lib/systemd/systemd
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
|
|
|
- distro: debian9
|
|
version: latest
|
|
init: /lib/systemd/systemd
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
|
|
|
- distro: debian10
|
|
version: latest
|
|
init: /lib/systemd/systemd
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
|
|
|
- distro: amazon
|
|
init: /lib/systemd/systemd
|
|
version: latest
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
|
|
|
- distro: fedora
|
|
init: /lib/systemd/systemd
|
|
version: latest
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
|
|
|
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="${PWD}":/etc/ansible/roles/ansible-mysql-hardening:ro ${run_opts} rndmh3ro/docker-${distro}-ansible:${version} "${init}" > "${container_id}"'
|
|
|
|
# Install ansible galaxy requirements
|
|
- 'docker exec "$(cat ${container_id})" ansible-galaxy install -c -r /etc/ansible/roles/ansible-mysql-hardening/requirements.yml -p /etc/ansible/roles/'
|
|
|
|
# Test role.
|
|
- 'travis_wait docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/ansible-mysql-hardening/tests/test.yml'
|
|
|
|
# Verify role
|
|
- 'inspec exec https://github.com/dev-sec/mysql-baseline/ -t docker://$(cat ${container_id}) --no-distinct-exit'
|
|
|
|
after_failure:
|
|
# Check MySQL settings.
|
|
- 'docker exec --tty ${container_id} env TERM=xterm cat /var/log/mysql/error.log'
|
|
- 'docker exec --tty ${container_id} env TERM=xterm cat /var/log/mysql.err'
|
|
- 'docker exec --tty ${container_id} env TERM=xterm cat /var/log/mysql.log'
|
|
notifications:
|
|
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|