check jboss process

I have the below play to identify if JBoss java process is up. I am expecting the msg not to be printed (skipped) if JBoss is down. Am I doing anything wrong here?

tasks:

  • name: Check JBoss java process
    shell: ps -ef | grep java | grep “jboss.server”
    register: jboss_java_process
    ignore_errors: false

  • debug: msg=“JBoss Process is running on {{ inventory_hostname }}”
    when: jboss_java_process.stdout.find(“jboss.server”) != -1

-SKR

Hi,
can you run it with -vv and post the output?