Let me know if this the correct way, any other ways are most welcome to
implement this

---
- hosts: all
  gether_facts: true
  user: root
  tasks:
    -  name: stop-tomcat
       when: ansible_facts['os_family']== "RedHat"
       command: sh '/opt/deploy/tomcatstop.sh'

  tasks1:
    name: start-tomcat
    when: ansible_facts['os_family']== "RedHat"
    command: sh '/opt/deploy/tomcatstart.sh'

  tasks2:
    - name: Verifying tomcat service to make sure it is in online state
      shell: "svcs tomcat"
      register: result
      until: result.stdout_lines.1.split().0 == "online"
      retries: 5
      delay: 30

On Tue, Jun 15, 2021 at 3:14 PM Amit Kulkarni <amit1811...@gmail.com> wrote:

> Hello Experts,
>
> If anyone has has implemented tomcat start and stop on multiple hosts,
> please .let me know.
>
> Regards
> Amit
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAON3ZR2iMK551JR%2BSD-OycQGtR303jqeXav6jqGtbV9QoYZmxQ%40mail.gmail.com.

Reply via email to