我有一些持续集成检查,运行了一些 ansible-playbook
命令。每个剧本可能会运行许多剧本,包括许多大角色。
时不时地,有人会在 ansible-playbook
时引入一些导致警告的更改。运行,例如像这样:
[WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: "{{ some_variable}}" not in
some_result.stdout
或者:
[WARNING]: Consider using unarchive module rather than running tar
或一些弃用警告,如:
[DEPRECATION WARNING]: ec2_facts is kept for backwards compatibility but usage
is discouraged. The module documentation details page may explain more about
this rationale.. This feature will be removed in a future release. Deprecation
warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
等等。有时,当我们升级 ansible 版本时会弹出这些警告。不管它们为什么会发生,我真的很想以某种方式拥有
ansible-playbook
当命令导致这些警告之一时,命令会大声失败,而不是安静地继续并让我的 CI 检查成功。有没有办法做到这一点?我目前正在使用 ansible 2.4.3。我发现很多关于 的方法的讨论隐藏 这些警告,但没有发现任何关于将它们提升为硬错误的信息。
最佳答案
我有完全一样的问题。我的解决方法是:
我知道这并不理想,所以如果您提供了一个不错的解决方案,请分享:-)
关于ansible:促进对错误的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50031257/