openstack-ansible-ops/osquery/roles/osquery/.travis.yml.simple

62 lines
1.7 KiB
Plaintext

---
sudo: required
dist: trusty
language: generic
env:
- suite: default
- suite: default-osquery-syslog
- suite: default-osquery-syslog-fs
before_install:
- sudo apt-get -qq update
- sudo apt-get install -y python python-pip
- "[ -f get-dependencies.sh ] && sh -x get-dependencies.sh"
## serverspec test
- sudo apt-get install -qq ruby2.0 rake
- sudo gem2.0 install serverspec
install:
# Install ansible
- sudo pip install ansible
# Check ansible version
- ansible --version
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg
- "echo \"[test-kitchen]\nlocalhost\" > inventory"
- gem2.0 --version
# Install role dependencies
# ...
script:
# Basic role syntax check
- "ansible-playbook -i inventory --syntax-check test/integration/${suite}/default.yml"
# Run the role/playbook with ansible-playbook
- "ansible-playbook -i inventory --connection=local --sudo -vvvv test/integration/${suite}/default.yml"
# Run the role/playbook again, checking to make sure it's idempotent
- >
ansible-playbook -i inventory test/integration/${suite}/default.yml --connection=local --become
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Playbook specific tests
# - "cd test/integration/${suite}/serverspec/ && bundle exec rake spec"
after_failure:
- "ls -l /var/log/ /var/log/osquery/"
- "sudo cat /var/log/osquery*.log /var/log/osquery/*.log"
- "sudo cat /etc/rsyslog.d/30-osquery-target.conf"
- "sudo systemctl -l status"
- "sudo journalctl -xe --no-pager"
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/