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

Thanks&regards
Prajwal




On Thu, 26 Nov, 2020, 6:39 pm blue fox, <[email protected]> wrote:

> sorry , i don't explain my issue exactly
>
> this is a real example
>
> playbook1 -- host1
> playbook2-- another host
> return
> playbook1-- host2
> playbook2 -- another host
>
> --------------
> thank you
>
>
> Le jeudi 26 novembre 2020 à 14:04:06 UTC+1, [email protected] a écrit :
>
>> ---
>> - hosts: 10.0.10.100
>>   tasks:
>>   - include_tasks: playbook1.yml
>>   - include_tasks: playbook2.yml
>>
>> ---
>> - hosts: 10.0.20.200
>>   tasks:
>>   - include_tasks: playbook1.yml
>>   - include_tasks: playbook2.yml
>>
>>
>> or you can write this way too directly in main playbook..
>> ---
>> - hosts: 10.0.10.100
>>   tasks:
>>   - name: playbook 1
>>     yum :
>>   - name: playbook 2
>>     service :
>>
>> ---
>> - hosts: 10.0.20.200
>>   tasks:
>>   - name: playbook 1
>>     yum :
>>   - name: playbook 2
>>     service :
>>
>> On Thu, Nov 26, 2020 at 6:28 PM blue fox <[email protected]> wrote:
>>
>>> 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
>>> -----------------
>>> host2____
>>> Playbook1
>>> Playbook2
>>> Le jeudi 26 novembre 2020 à 13:46:14 UTC+1, [email protected] a
>>> écrit :
>>>
>>>> Did you try using loop like this -
>>>> hosts.yml
>>>> ---
>>>> hosts:
>>>> - 10.0.10.100
>>>> - 10.0.20.200
>>>>
>>>> In playbook
>>>> - name: CONFIGURATION LOOP - 1
>>>>   include_tasks: loop.yml
>>>>   loop: "{{ hosts }}"
>>>>
>>>> - name: CONFIGURATION LOOP - 2
>>>>   include_tasks: loop.yml
>>>>   loop: "{{ hosts }}"
>>>>
>>>>
>>>> On Thursday, 26 November 2020 at 18:08:37 UTC+5:30 [email protected]
>>>> wrote:
>>>>
>>>>> no, i don't need like that , i need something like this:
>>>>>
>>>>>
>>>>> ---
>>>>> - name: playbook 1 for host 1
>>>>>   hosts: 10.0.10.100
>>>>>   tasks:
>>>>>   - name: install app
>>>>>
>>>>> ---
>>>>> - name: playbook 2 for host 1
>>>>>   hosts: 10.0.10.100
>>>>>   tasks:
>>>>>   - name: install app
>>>>>
>>>>> ---
>>>>> - name: playbook 1 for host 2
>>>>>   hosts: 10.0.10.200
>>>>>   tasks:
>>>>>   - name: install app
>>>>>
>>>>> ---
>>>>> - name: playbook 2 for host 2
>>>>>   hosts: 10.0.10.200
>>>>>   tasks:
>>>>>   - name: install app
>>>>>
>>>>> Le jeudi 26 novembre 2020 à 10:08:22 UTC+1, [email protected] a
>>>>> écrit :
>>>>>
>>>>>> Hello,
>>>>>> If you want to configure playbooks in easy way without using serial,
>>>>>> you can write like this way too.
>>>>>> ---
>>>>>> - name: playbook 1 for host 1
>>>>>>   hosts: 10.0.10.100
>>>>>>   tasks:
>>>>>>   - name: install app
>>>>>>
>>>>>> ---
>>>>>> - name: playbook 1 for host 2
>>>>>>   hosts: 10.0.10.200
>>>>>>   tasks:
>>>>>>   - name: install app
>>>>>>
>>>>>> ---
>>>>>> - name: playbook 2 for host 1
>>>>>>   hosts: 10.0.10.100
>>>>>>   tasks:
>>>>>>   - name: install app
>>>>>>
>>>>>> ---
>>>>>> - name: playbook 2 for host 2
>>>>>>   hosts: 10.0.10.100
>>>>>>   tasks:
>>>>>>   - name: install app
>>>>>>
>>>>>> On Thu, Nov 26, 2020 at 1:16 PM blue fox <[email protected]> wrote:
>>>>>>
>>>>>>> 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
>>>>>>> Le jeudi 26 novembre 2020 à 04:29:56 UTC+1, [email protected] a
>>>>>>> écrit :
>>>>>>>
>>>>>>>> Use serial=1
>>>>>>>>
>>>>>>>>
>>>>>>>> https://docs.ansible.com/ansible/latest/user_guide/playbooks_strategies.html#setting-the-batch-size-with-serial
>>>>>>>>
>>>>>>>>
>>>>>>>> On Thu, 26 Nov 2020 at 01:25, blue fox <[email protected]> wrote:
>>>>>>>>
>>>>>>>>> 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
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> 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/f0609b04-3912-4c32-81d2-22ea4d1e01c2n%40googlegroups.com
>>>>>>>>> <https://groups.google.com/d/msgid/ansible-project/f0609b04-3912-4c32-81d2-22ea4d1e01c2n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>> .
>>>>>>>>>
>>>>>>>> --
>>>>>>>> Sent from a mobile device - please excuse the brevity, spelling and
>>>>>>>> punctuation.
>>>>>>>>
>>>>>>> --
>>>>>>> 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/c68ed54f-72af-43ec-8c70-6198ffe7d0d3n%40googlegroups.com
>>>>>>> <https://groups.google.com/d/msgid/ansible-project/c68ed54f-72af-43ec-8c70-6198ffe7d0d3n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> --
>>> 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/e5421973-8115-437c-93d1-071d5f24e2cdn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/e5421973-8115-437c-93d1-071d5f24e2cdn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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/296cd974-a623-47a9-9356-9c644805094an%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/296cd974-a623-47a9-9356-9c644805094an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAMQ8AOgN42iTTJ9Gi0jC4ueBzY8zBHSNWR9zD4mwn%2BNxH7-d5g%40mail.gmail.com.

Reply via email to