Test if a server is reachable from host and has port open with Ansible


I want to test if the host I am provisioning can reach a specific server and connect to a specific TCP port. If it can’t the playbook should fail.

How can I do that?


There is wait_for module for this.
To check that target.host can access remote.host:8080:

There are a lot of other examples in the documentation.

Leave a Reply