Run Playbooks for each hosts

Hello;

How to run 3 playbooks for each server alone:

Example:

[webservers]

10.10.10.10

20.20.20.20

Run les 3 playbook for 10.10.10.10, after run it for 20.20.20.20

Thank you

Use serial=1

https://docs.ansible.com/ansible/latest/user_guide/playbooks_strategies.html#setting-the-batch-size-with-serial

Yes , i looked that, but i need to run playbook for one host after run another playbook after return for running the playbook1 for the second host.

Example:

Playbook1 for 10.10.10.10
Playbook2 for another host
playbook1 for 20.20.20.20
playbook2 for another host and continue executing another playbook

Thank you

Hello,
If you want to configure playbooks in easy way without using serial, you can write like this way too.

no, i don’t need like that , i need something like this:

Did you try using loop like this -
hosts.yml

your loop example = your last easy way example
each play run for 2 hosts , and me i need each 2 playbook run in one host each time

Example
host1____
playbook1
Playbook2

  • hosts: 10.0.10.100
    tasks:

  • include_tasks: playbook1.yml

  • include_tasks: playbook2.yml

sorry , i don’t explain my issue exactly

this is a real example

playbook1 – host1
playbook2-- another host
return
playbook1-- host2
playbook2 – another host

You can write python code to execute playbooks in that use python module ansible_runner

Thanks&regards
Prajwal

You have any example please ?
Thank you