Hi, change to when: htop_is_running.stdout == '0'
On Friday, 1 October 2021 at 05:40:14 UTC+5:30 [email protected] wrote: > can somebody explaine me why service sis not starting > > on mhost1: > [root@mhost1 ~]# ps -ef | grep -v grep | grep httpd > [root@mhost1 ~]# > > > --- > - hosts: mhost1 > tasks: > - name: check status httpd > shell: ps -ef | grep -v grep | grep httpd|wc -l > register: htop_is_running > notify: sreeni > > - name: Report running status > debug: > msg="If I am 1 then I'm not running, I am {{ > htop_is_running.stdout }}" > > handlers: > - name: sreeni > systemd: > name: httpd > state: restarted > when: htop_is_running.stdout == 0 > > output > **** > [tom@ansible-c ansible]$ ansible-playbook p.yml > > PLAY [mhost1] > ******************************************************************************************************************************************************************************* > > TASK [Gathering Facts] > ********************************************************************************************************************************************************************** > ok: [mhost1] > > TASK [check status httpd] > ******************************************************************************************************************************************************************* > changed: [mhost1] > > TASK [Report running status] > **************************************************************************************************************************************************************** > ok: [mhost1] => { > "msg": "If I am 1 then I'm not running, I am 0" > } > > RUNNING HANDLER [sreeni] > ******************************************************************************************************************************************************************** > skipping: [mhost1] > > PLAY RECAP > ********************************************************************************************************************************************************************************** > mhost1 : ok=3 changed=1 unreachable=0 > failed=0 skipped=1 rescued=0 ignored=0 > > [tom@ansible-c ansible]$ > > > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fef94fba-d3dc-4905-9f94-d24c2420cbf0n%40googlegroups.com.
