From 9a2c887af42f47273d791bad81df90968ab18c84 Mon Sep 17 00:00:00 2001 From: Luca Favatella Date: Wed, 24 May 2017 18:11:19 +0100 Subject: [PATCH] Print logs in case of error Print system logs (e.g. systemd), Riak errors, Solr logs, Ansible logs. Prefer making Ansible to log to local file instead of [default syslog](https://docs.ansible.com/ansible/intro_configuration.html#log-path) in order not to spam syslog and to ensure printing out of all Ansible logs (e.g. for identifying a "changed" task in the middle while testing Ansible idempotency). --- .travis.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9d95094..359c5bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,8 +19,8 @@ install: # Check ansible version - ansible --version - # Create ansible.cfg with correct roles_path - - 'printf "[defaults]\nroles_path=../" > ansible.cfg' + # Create ansible.cfg with correct roles_path and log file path + - touch ansible.log && { printf "[defaults]\nroles_path=../\nlog_path=ansible.log" > ansible.cfg; } env: - ANSIBLE_HOST_KEY_CHECKING=False @@ -28,6 +28,13 @@ env: script: - ansible-playbook tests/test.yml -v +after_failure: + - sudo tail -n 100 /var/log/syslog + - ls -l /var/log/riak + - ls /var/log/riak/error.log* && cat $(ls -tr /var/log/riak/error.log*) + - ls /var/log/riak/solr.log* && cat $(ls -tr /var/log/riak/solr.log*) + - cat ansible.log + notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ slack: