我有一些持续的集成检查,它运行一些ansible-playbook命令.每个剧本可能正在运行许多剧本,包括许多大型角色.
每隔一段时间,有人会引入一些在ansible-playbook运行时引起警告的变化,例如:
[WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: "{{ some_variable}}" not in
some_result.stdout
Run Code Online (Sandbox Code Playgroud)
要么:
[WARNING]: Consider using unarchive module rather than running tar
Run Code Online (Sandbox Code Playgroud)
或者一些弃用警告,例如:
[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.
Run Code Online (Sandbox Code Playgroud)
等等.有时,当我们升级ansible版本时会弹出这些警告.无论它们为什么会发生,我真的希望某种方式让ansible-playbook命令在引起其中一个警告时大声失败,而不是静静地继续并让我的CI检查成功.有没有办法做到这一点?我目前正在使用ansible 2.4.3.
我发现很多关于隐藏这些警告的方法的讨论,但没有找到任何关于将它们提升为硬错误的信息.
Bap*_*ias -2
any_errors_fatal里面有一个选项ansible.cfg,那么把
any_errors_fatal = True
Run Code Online (Sandbox Code Playgroud)