On 01/10/2021 14:53, Sandip Bhattacharya wrote:


On 01.10.21 02:10, subbamma natla wrote:
can somebody explaine me why service sis not starting

on mhost1:
[root@mhost1 ~]#  ps -ef | grep -v grep | grep httpd

It might be cleaner to use pgrep instead for process check. Then you can use 
something like this:

   tasks:
     - name: Process check
       command: pgrep httpd
       register: httpd_check
       ignore_errors: true
     - debug:
         var: httpd_check.failed

     - name: restart httpd if down
       systemd:
         name: httpd
         state: restarted
       when: httpd_check.failed



What's wrong with asserting that the service should be started?

- systemd:
    name: httpd
    state: started

Regards
         Racke

--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration.

--
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/35d2fdf8-12b4-fe9f-f760-cddee2d3692a%40linuxia.de.

Attachment: OpenPGP_0x5B93015BFA2720F8.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to