I am creating a playbook to install a software and I need to restart the server int he middle of the playbook.
I need my Ansible host to wait till the server is back and execute the rest of my tasks but this is not happeing.
These are my Ansible tasks related to reboot and wait:
...
- name: restart server
shell: shutdown -r now
async: 1
poll: 0
become: yes
become_method: sudo
ignore_errors: true
- name: waiting for server to come back after reboot
local_action: wait_for host={{ ansible_ssh_host }} state=started port=22 delay=30 timeout=300 coect_timeout=15
....
This is the output of ruing my playbook:
...
TASK [restart server] **********************************************************
fatal: [X.X.X.X]: UNREACHABLE! => {"changed": false, "msg": "Failed to coect to the host via ssh.", "unreachable": true}
to retry, use: --limit @ansible_pb.retry
PLAY RECAP *********************************************************************
X.X.X.X : ok=2 changed=0 unreachable=1 failed=0
Any idea what is wrong and how can I fix it?
برچسب:
نویسنده: استخدام کار