我一直在嘗試創建一個非常簡單的Ansible操作手冊,它將重新啓動服務器並等待它回來。重新啓動2.1.1.0失敗
我以前在Ansible 1.9上有一個工作,但我最近升級到2.1.1.0,它失敗了。
我重新啓動的主機名爲idm,IP地址爲192.168.200.23。
的劇本正在從我的主機192.168.200.1運行帶有命令
$ ansible-playbook reboot.yml -vvvv
這是我使用
---
- hosts: idm
tasks:
- name: Restart server
become: yes
shell: sleep 2 && /sbin/shutdown -r now "Ansible system package upgraded"
- name: waiting 60 secs for server to come back
local_action: wait_for host=192.168.200.23 port=22 delay=60 connect_timeout=200
become: false
可重啓機器精細的劇本,但幾乎立即失敗與
<192.168.200.23> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.200.23> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/myork/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.200.23 '/bin/sh -c '"'"'LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1472242630.58-176546106960362/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1472242630.58-176546106960362/" > /dev/null 2>&1 && sleep 0'"'"''
fatal: [idm]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true}
任何想法我在這裏錯過了嗎?
謝謝!
的可能的複製[如何使用Ansible等待服務器重新啓動?(http://stackoverflow.com/questions/23877781/如何等待服務器重新啓動使用可能) –