Ansible (14) wait_for module, ansiblewait_for

Source: Internet
Author: User

Ansible (14) wait_for module, ansiblewait_for
Module description

When you use service to start tomcat or database, are they actually starting? Do you want to confirm this?
This is what the wait_for module does.Wait for a thing to happen and continue. It can wait for a port to be occupied, and then do the following, Or do another thing after a certain time-out.

Common Parameters
Parameter Name Required? Default Value Option Description
Connect_timeout No 5 The waiting time before the next event occurs, in seconds.
Delay No Latency: the number of seconds before the next task.
Host No 127.0.0.1 Host that executes this module
Path No If a file exists in the file system, the next step is to continue.
Port No Port number, such as 8080
State No Started Present/started/stopped/absent When the object is a port, the start State ensures that the port is opened, and the stoped State determines that the port is closed. When the object is a file, the present or started confirms that the file exists, the absent will confirm that the file does not exist.
Case
# Check port 8000 on the current host after 10 seconds until the port is started-wait_for: port = 8000 delay = 10 # Check path =/tmp/foo until the file exists-wait_for: path =/tmp/foo # Until/var/lock/file. after the lock is removed, continue-wait_for: path =/var/lock/file. lock state = absent # continue until/proc/3466/status is removed-wait_for: path =/proc/3466/status state = absent

All the modules used in the previous homework have been explained.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.