gpt4 book ai didi

ansible - ansible 中 flush_handlers 的替代方案

转载 作者:行者123 更新时间:2023-12-01 05:51:40 25 4
gpt4 key购买 nike

我的 Ansible 剧本中有处理程序,我想立即触发这些通知。如何在不调用 meta_handler = flush_handler 的情况下实现这一点? ?
这在 Ansible 2.5.6 中运行良好,但在此版本之后会显示一条警告:

[WARNING]: flush_handlers task does not support when conditional


任何帮助,将不胜感激。

最佳答案

这是一个 Unresolved 问题 meta: flush_handlers doesn't honor when clause #41313 .
(2021-04-20 问题仍未解决。如果状态发生变化,请在此处评论)
引用我的comment :

Let me describe a valid scenario (below). "flush_hadlers" is needed after tasks abc.yml complete and before tasks def.yml start. But the file with the tasks xyz.yml is imported when OS is RH only. Here Ansible complains:

[WARNING]: flush_handlers task does not support when conditional
能够抑制警告会很好。
# cat xyz.yml
- include_tasks: abc.yml
- meta: flush_handlers
- include_tasks: def.yml

# cat playbook.yml
...
tasks:
- import_tasks: xyz.yml
when: (ansible_os_family == "RedHat" )

关于ansible - ansible 中 flush_handlers 的替代方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53400555/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com