如何在 Ansible 中隐藏跳过的任务输出 [英] How can I hide skipped tasks output in Ansible

查看:52
本文介绍了如何在 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}}"'

但我在一个角色调用中只部署了一个应用程序.当我部署多个应用程序时,我会多次调用角色.但是每次都有很多跳过任务输出(来自不通过条件的任务),这是我不想看到的.我怎样才能避免它?

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 callback 不会在跳过的任务上输出任何内容.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆