- name : restart app
  hosts: webserver
  serial: 1
  tasks: 
    - name: send email activity start
      mail:

    block:
       - name: Task 1
       - name: Task 2 - reboot node
         reboot:
       - name: check node is up and running
         uri:
           url: http://SomeURL
           method: GET
           status_code: 200
         register: _result
         until: (_result.status == 200)
         retries: 720  #  720 * 5 seconds = 1hour (60*60/5)
         delay: 5  #  Every 5 seconds
    
   - name: send email activity completed
     run_once: true
     mail:


- name : restart app
  hosts: DBserver
  serial: 1
  tasks: 
    - name: send email activity start
      run_once: true
      mail:

    block:
       - name: Task 1
       - name: Task 2 - reboot node
       - name: check node is up and running
         uri:
           url: http://SomeURL
           method: GET
           status_code: 200
         register: _result
         until: (_result.status == 200)
         retries: 720  #  720 * 5 seconds = 1hour (60*60/5)
         delay: 5  #  Every 5 seconds
    
   - name: send email activity completed
     run_once: true
     mail:
On Monday, May 15, 2023 at 7:30:36 PM UTC+3 shloco wrote:

> I'm looking for a way to run the tasks that inside the block by node by 
> node but in other hand I need to send email once in the beginning and end 
> of the activity - after all nodes were reboot
>
> in my code example email was sent for each node the tasks are exec 
>
> note: I run the playbook via AWX
>
>
> [image: Screen Shot 2023-05-15 at 16.47.12.png]
>

-- 
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/f07e30cf-ca4c-4eeb-83d4-997de9d37e1cn%40googlegroups.com.

Reply via email to