更新时间:2022-06-10 23:18:04
如果要强制处理程序在两个任务之间而不是在播放结束时运行,则需要将此处理程序放在两个任务之间:
If you want to force the handler to run in between the two tasks instead of at the end of the play, you need to put this between the two tasks:
- meta: flush_handlers
示例摘自ansible 文档 :
Example taken from the ansible documentation :
tasks:
- shell: some tasks go here
- meta: flush_handlers
- shell: some other tasks
请注意,这将导致所有待处理的处理程序在该时刻运行,而不仅仅是特定的处理程序.
Note that this will cause all pending handlers to run at that point, not just that specific one.