Initializing the database can take a while (1-2min), so you'd need a relatively long timeout on a first startup. Either pinging '
http://localhost:8080/auth/' or looking in the log would work just fine. You can also use jboss-cli to check the status, for example to check if server is started fully:
bin/jboss-cli.sh --connect ':read-attribute(name=server-state)'
Or check the status of Keycloak individually:
bin/jboss-cli.sh --connect 'deployment-info --name=keycloak-server.war'
An alternative is to use Liqubase to extract the SQL schema for your database. That way Ansible can setup the database fully prior to starting Keycloak in the first place. If you're interested in that approach let me know and I'll let you know the details for that.