本文在ansible 2.2.1.0测试通过
用于等待指定的时间(默认是300秒)。在不指定任何选项的时候,这个模块什么都不做。
connect_timeoutdelayexclude_hostsstate=drained一起使用。用于指定,在寻找活跃的TCP链接的时候,要忽略的主机或IP列表。hostpathportsearch_regexstatepresent、started、stopped、absent、drained。started会确保端口打开;stopped会确保端口关闭;drained会检查活跃的链接。present和started会确保文件或字符串存在。absent会确保文件不存在或被移除。timeoutwait_for: port:8000 delay=10wait_for: host=0.0.0.0 port=8000 delay=10 state=drainedwait_for: host=0.0.0.0 port=8000 state=drained exclude_hosts=10.2.1.2,10.2.1.310.2.1.2和10.2.1.3上的连接。超时时间是300秒。
wait_for: path=/tmp/foo/tmp/foo这个文件存在。
wait_for: path=/tmp/foo search_regex=completedcompleted出现在文件/tmp/foo中。
wait_for: path=/var/lock/file.lock state=absentwait_for: path=/proc/3466/status state=absentlocal_action: wait_for port=22 host="{{ ansible_ssh_host | default(inventory_hostname) }}" search_regex=OpenSSH delay=10OpenSSH。并且不确保inventory_hostname是可解析的。每10秒检查一次,超时时间是300秒。