Thank you so much again Todd. It works and confirmed.

On Friday, June 7, 2024 at 5:12:41 PM UTC-5 Todd Lewis wrote:

> Try this:
> server_job.sh
>
> ansible-playbook main_job.yml -e "server=job1" --limit runtime-host-group &
> ansible-playbook main_job.yml -e "server=job2" --limit runtime-host-group &
> ansible-playbook main_job.yml -e "server=job3" --limit runtime-host-group &
> ansible-playbook main_job.yml -e "server=job4" --limit runtime-host-group &
> wait
>
>
> On 6/7/24 5:46 PM, wpgpo...@gmail.com wrote:
>
> Hello Group,
>
> Is there a way that I can run a playbook concurrently?
>
> Currently, if I'm running the script with multiple playbook (2x or 3x or 
> so), it will run and finish the first playbook before proceeding on the 
> next playbook in the line.
>
> The idea is that I want to run a script that has multiple playbooks (2x or 
> 3x or so) concurrently in parallel at the same time. Meaning, the job1, 
> job2, job3, and job4 will run at the same time and should NOT wait to 
> finish each other.
>
> Any help and guidance is highly appreciated.
>
>
> An example of the scenarios are below.
> Scenarios
> shell script
> /home/fuser/scripts/ansbile/playbooks/servers/server_job.sh
>
> server_job.sh
> ansible-playbook main_job.yml -e "server=job1" --limit runtime-host-group
> ansible-playbook main_job.yml -e "server=job2" --limit runtime-host-group
> ansible-playbook main_job.yml -e "server=job3" --limit runtime-host-group
> ansible-playbook main_job.yml -e "server=job4" --limit runtime-host-group
>
> runtime-host-group 
> [runtime-host-group]
> runtime001
> runtime002
>
> main_job.yml (using import_playbook)
> - name: Playbook to Stop/Start
>   hosts: all
> - name: Stop-Runtime | Stop the Runtime
>   import_playbook: 
> "/home/fuser/scripts/ansbile/playbooks/servers/playbook_sbxrun_runtime_stop_systemCTL.yml"
> - name: Start-Runtime | Start the Runtime
>   import_playbook: 
> "/home/fuser/scripts/ansbile/playbooks/servers/playbook_sbxrun_runtime_start_systemCTL.yml"
>
> playbook_sbxrun_runtime_stop_systemCTL.yml
> - name: Process to STOP
>   hosts: all
>   tasks:
>     - name: SystemCTL | STOP
>       service:
>         name: "{{ item }}"
>         state: stopped
>       become: yes
>       with_items:
>         - runtime-{{server}}.service
>         - monitor-{{server}}.service
>
> playbook_sbxrun_runtime_start_systemCTL.yml
> - name: Process to START
>   hosts: all
>   tasks:
>     - name: SystemCTL | STOP
>       service:
>         name: "{{ item }}"
>         state: started
>       become: yes
>       with_items:
>         - runtime-{{server}}.service
>         - monitor-{{server}}.service
>
>
> Thank you....
> Erwin
>
> -- 
> 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-proje...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/f996beb8-5458-4194-817b-33ee6221713bn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/ansible-project/f996beb8-5458-4194-817b-33ee6221713bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
> -- 
> Todd
>
>

-- 
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/116f5bec-de00-4b73-9c37-f3a85f4ddc17n%40googlegroups.com.

Reply via email to