这个 Ansible 角色已经被创建,并且这个 .travis.yml被用作一个例子来测试这个角色。除 sensu-client 外,所有服务都可以启动。
尝试解决问题
为了解决这个问题,在 travis 中添加了一个调试步骤。构建完成后抛出以下错误:
The command "sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test-${SITE}.yml | grep -q 'changed=0.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)
" exited with 1.
0.07s$ sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm sudo systemctl status sensu-client.service -l
● sensu-client.service - LSB: Sensu monitoring framework client
Loaded: loaded (/etc/rc.d/init.d/sensu-client)
Active: failed (Result: exit-code) since Mon 2016-08-08 00:18:20 UTC; 131ms ago
Docs: man:systemd-sysv-generator(8)
Process: 1534 ExecStart=/etc/rc.d/init.d/sensu-client start (code=exited, status=1/FAILURE)
Aug 08 00:18:19 c6354976113c systemd[1]: Starting LSB: Sensu monitoring framework client...
Aug 08 00:18:19 c6354976113c sensu-client[1534]: /etc/init.d/sensu-service: line 71: /etc/init.d/functions: No such file or directory
Aug 08 00:18:19 c6354976113c sensu-client[1534]: Starting sensu-client/etc/init.d/sensu-service: line 79: daemon: command not found
Aug 08 00:18:20 c6354976113c sensu-client[1534]: /etc/init.d/sensu-service: line 88: echo_failure: command not found
Aug 08 00:18:20 c6354976113c systemd[1]: sensu-client.service: control process exited, code=exited status=1
Aug 08 00:18:20 c6354976113c systemd[1]: Failed to start LSB: Sensu monitoring framework client.
Aug 08 00:18:20 c6354976113c systemd[1]: Unit sensu-client.service entered failed state.
Aug 08 00:18:20 c6354976113c systemd[1]: sensu-client.service failed.
当 ansible 角色部署在远程系统上时,sensu-client 启动,但它在 Travis 上失败,尽管其他服务能够启动。