如何在Ansible中隐藏跳过的任务输出 [英] How can I hide skipped tasks output in Ansible
问题描述
例如,我扮演Ansible角色
I have Ansible role, for example
---
- name: Deploy app1
include: deploy-app1.yml
when: 'deploy_project == "{{app1}}"'
- name: Deploy app2
include: deploy-app2.yml
when: 'deploy_project == "{{app2}}"'
但是我在一个角色调用中仅部署了一个应用程序.部署多个应用程序时,我会多次调用角色.但是每次都有很多skipped tasks output
(来自不通过条件的任务),我不想看到.我该如何避免呢?
But I deploy only one app in one role call. When I deploy several apps, I call role several times. But every time there is a lot of skipped tasks output
(from tasks which do not pass condition), which I do not want to see. How can I avoid it?
推荐答案
Ansible允许您使用自定义回调.
Ansible allows you to control its output by using custom callbacks.
在这种情况下,您可以简单地使用 skippy
回调不会在跳过的任务上输出任何内容.
In this case you can simply use the skippy
callback which will not output anything on a skipped task.
也就是说,skippy
现在已被弃用,并将在ansible v2.11中删除.
That said, skippy
is now deprecated and will be removed in ansible v2.11.
这篇关于如何在Ansible中隐藏跳过的任务输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!