How to wait for server restart using Ansible?

后端 未结 11 1209
半阙折子戏
半阙折子戏 2020-12-07 13:06

I\'m trying to restart the server and then wait, using this:

- name: Restart server
  shell: reboot

- name: Wait for server to restart
  wait_for:
    port=         


        
11条回答
  •  盖世英雄少女心
    2020-12-07 13:31

    You should change the wait_for task to run as local_action, and specify the host you're waiting for. For example:

    - name: Wait for server to restart
      local_action:
        module: wait_for
          host=192.168.50.4
          port=22
          delay=1
          timeout=300
    

提交回复
热议问题