I have a below task in my playbook. It checks the desired count of the process specified in vars.
If a task returned 50 value and since it has 0. my condition gets satisfied which is incorrect.
vars:
-
sap_process_count: “0”
tasks: -
name: Pre Check - Verifying app status
shell: ps -ef | grep sap | grep -v grep | wc -l
register: prechk_process_count
ignore_errors: yes -
debug:
msg: “application is already stopped in {{ inventory_hostname }}”
when: “sap_process_count in prechk_process_count.stdout”
I tried with the condition "prechk_process_count.stdout == “0"” . it’s working fine
my question, Is it possible to define the process count “0” through a variable in "prechk_process_count.stdout == “0"” condition.
Please advise.