> ## Content Index
> Fetch the complete content index at: https://scriptcrunch.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Check Application Status Using Ansible Play - wait_for moudle
- URL: https://scriptcrunch.com/check-application-status-using-ansible/
- Published: 2016-11-17T13:15:26.000Z
- Updated: 2026-06-23T08:56:18.000Z
- Author: Scriptcrunch Editorial
- Tags: Ansible, Tutorials, #Migrated-1758801465347, #wp, #wp-post, #Import 2025-09-25 11:57

I have an application running on port 8080\. I want to check if the port is open and the application is successfully running on the port. How can i do this using [ansible](https://scriptcrunch.com/tag/ansible/) wait\_for module?

## Check Application Status Using waif\_for module

There are two things,

1. If a port is opened, it doesn't mean your application has started.
2. You need to check the response code for a specific URL to make sure that your application is running.
3. Download the page content and check for a specific string in your application to make sure you are getting the right application page.

Let's look at each scenario.

### Check for Port

You can check for a specific port using the following code. - name: Wait for apache app to kick in wait\_for: port: 80 delay: 10 timeout: 900The above code will check for port 80 connectivity for 900 seconds. If the port doesn't come up within 900 seconds, then ansible will throw a timeout error. You can change the parameter based on your needs.

### Check based on HTTP response code

You can make sure the application is up using the following code which loops until a particular response code is retrieved. - name: "wait for website to come up" uri: url: "http://localhost:8080" status\_code: 200 register: result until: result.status == 200 retries: 90 delay: 10The status code might change depend on the application. Some applications might respond with 401\. Test the response code with a REST client before you implement the ansible code.

### Check based on page content

You can use the following content to check the application status based on a string in the web page. - name: Check if web page contains \`user\` string uri: url=http://localhost:8080 return\_content=true register: response failed\_when: "'user' not in response.content"You can replace "user" with a string that is available in your application web page.