I am trying to run if else statement inside shell module in ansible playbook but looks like my else statement is not executing in any case.
- name: verify application/database processes are not running
shell: if ps -eaf | egrep 'apache|http'|grep -v grep > /dev/null echo 'process_running';else echo 'process_not_running';fi
ignore_errors: false
register: app_process_check
Please correct me here.