Is there an ansible module that check whether a port is not in LISTEN state?
I think you're looking for the wait_for module. It will allow you to check and make an action when a certain port is available and more.