只需按照以下步骤,当我通过命令行运行相同的作业时,我就可以生成报告:
% sudo su jenkins
% export ANSIBLE_CALLBACK_PLUGINS="/usr/lib/python2.7/site-packages/ara/plugins/callbacks"
% /bin/ansible-playbook -v -i /etc/ansible/my-inventory ./test-job.yaml`
但是,在通过 Jenkins 执行相同的作业时,我在生成 ARA 报告时遇到了一些问题。我做了以下事情:
在 $JENKINS_HOME/.bashrc 中:
导出 ANSIBLE_CALLBACK_PLUGINS="/usr/lib/python2.7/site-packages/ara/plugins/callbacks" `
通过以下方式定义了以下环境变量:Jenkins UI -> Manage Jenkins -> Configure System:
名称:ANSIBLE_CALLBACK_PLUGINS 值:/usr/lib/python2.7/site-packages/ara/plugins/callbacks
在我的 Ansible Job -> Execute shell 中,我指定了以下内容:
导出 ANSIBLE_CALLBACK_PLUGINS="/usr/lib/python2.7/site-packages/ara/plugins/callbacks"
/bin/ansible-playbook -v -i /etc/ansible/my-inventory ./test-job.yaml
这是 .ansible.cfg 的内容:
[default]
# the following lines added for ara callback_plugins configuration is required for the ARA callback
callback_plugins = /usr/lib/python2.7/site-packages/ara/plugins/callbacks
# action_plugins and library configuration is required for the ara_record and ara_read modules
action_plugins = /usr/lib/python2.7/site-packages/ara/plugins/actions
library = /usr/lib/python2.7/site-packages/ara/plugins/modules
[ara]
ARA_HOST = 0.0.0.0
ARA_PORT = 8443