Something without the nested roles, as those are clearly not doing
what you want.
It's a bit hard to understand what needs to be executed where.
I would start out with a playbook and not bother with roles initially.

On Wed, 31 May 2023 at 17:32, Narmada Karthika <[email protected]> wrote:
>
> So, is there any other alternate solution you would suggest  for my 
> requirement.
>
> On Tue, May 30, 2023, 4:24 PM Kosala Atapattu <[email protected]> 
> wrote:
>>
>> I've done this before for a complicated piece of work I did. I had roles 
>> running on several delegate proxies (yeah I called them that, since we had 
>> 5-6 of them :)).
>>
>> However I did not delegate a role in mycase, but all the tasks were written 
>> with delegate_to: "{{ delgate_host }}" where I can override delegate_host 
>> variable at the role level.
>>
>> I do not believe this is a widely used regime, and I did ran in to some 
>> issues when you call role -> role -> role, the last layer lost visibility to 
>> all the top level variables. Like @Dick Visser said this will not be the 
>> smoothest sailing, but surely works.
>>
>> I wrote this originally for Ansible 2.9, but when I tested with 2.11, most 
>> of the issues I faced were gone.
>>
>> Kosala
>>
>>
>>
>>
>> On Wed, May 31, 2023 at 7:42 AM Narmada Karthika <[email protected]> 
>> wrote:
>>>
>>> any suggestions please to satisfy my above request...
>>>
>>> On Friday, May 26, 2023 at 10:48:02 AM UTC-7 Narmada Karthika wrote:
>>>>
>>>> local host is the ansible master where the role2 has to be executed. 
>>>> because the role2 is to run some api commands and get server details
>>>> role1` is to install components on the server which I get from role2
>>>>
>>>> On Fri, May 26, 2023 at 10:34 AM Dick Visser <[email protected]> wrote:
>>>>>
>>>>> I haven't tried this myself (as it sounds too complicated and error 
>>>>> prone), but I'm guessing because you first run on the remote Windows  
>>>>> host, and from there during the other role, localhost is in fact that 
>>>>> remote host.
>>>>> It makes sense, in a way.
>>>>>
>>>>> I may be completely wrong though
>>>>>
>>>>> On Fri, 26 May 2023 at 19:24, Narmada Karthika <[email protected]> wrote:
>>>>>>
>>>>>> I am trying a playbook for a role and calling another role with in it.
>>>>>> role1 where i am running playbook need to be executed on windows hosts, 
>>>>>> role 2 which is being called in role1 needs to be executed on 
>>>>>> localhost(linux).
>>>>>> this is from the tasks/main.yml file for role1.
>>>>>> but still it is picking windows node from role1 and failing..
>>>>>> - name: calling serverdata role here
>>>>>>   include_role:
>>>>>>     name: serverdata (role2)
>>>>>>     tasks_from: main.yml
>>>>>>     apply:
>>>>>>       delegate_to: localhost
>>>>>>
>>>>>> --
>>>>>> 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/18f6e3a2-5f79-43a2-9d44-2b09e18fa73en%40googlegroups.com.
>>>>>
>>>>> --
>>>>> Sent from Gmail Mobile
>>>>>
>>>>> --
>>>>> 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/CAF8BbLaKuC8mNa159X8ePAuVop7jCpCkYs7--hqteHRLqmy2Kw%40mail.gmail.com.
>>>>
>>>>
>>>>
>>>> --
>>>>  Thanks,
>>>> Narmada Karthika Chitturi
>>>>
>>>
>>> --
>>> 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/1f82284f-386c-4389-a269-474dd5d0a38cn%40googlegroups.com.
>>
>> --
>> 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/CAP7S5HZ7%2Btw01PzwzqxfUDxags3PyQ5GnskuoLUwX1snsgs7Og%40mail.gmail.com.
>
> --
> 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/CABdF8S3Mmu_zM%3DK5kWbE9T%2BDOJ1ScSka9sgCGWDLu0iLnL%3DAcw%40mail.gmail.com.

-- 
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/CAF8BbLadWHSx%2B%3DykgpZ8h3t2Lkwctx2c8BvvM9VizUME95U%3DAw%40mail.gmail.com.

Reply via email to