How to force handler to run before executing a task in Ansible?

后端 未结 1 1253
离开以前
离开以前 2020-12-24 04:46

I have a playbook which should configure on specified IP, and than connect to this app to configure stuff inside.

I\'ve got a problem: I need to restart app after I\

1条回答
  •  囚心锁ツ
    2020-12-24 05:17

    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

    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.

    0 讨论(0)
提交回复
热议问题