As I see, you're trying to use variables from one host or group of hosts 
(cmsserver) from another different group (jobserver). Those variables have 
a name in common but they're still different; you can't use reference them 
as if they were the same.

But I believe this post might help you:

https://serverfault.com/questions/638507/how-to-access-host-variable-of-a-different-host-with-ansible

Hope that helps

El viernes, 9 de agosto de 2019, 8:23:59 (UTC-5), nandha kumar escribió:
>
> Hello Angel,Dick,
>
> Below is my playbook:
>
> ***********************************************************************************
> ---
> - hosts: all
>   gather_facts: False
>   roles:
>     - pagefile
> - name: STOP_Services_CMS
>   hosts: cmsserver
>   gather_facts: False
>   tasks:
>     - name: Get services for Datasevices
>       win_shell: 'Get-Service | Where {($_.DisplayName -like "*Apache*") 
> -OR ($_.DisplayName -like "*Server Intell*")} | Select-Object Name, 
> DisplayName | ConvertTo-Json'
>       register: nandhu
>     - name: Stop services of Dataservices
>       win_service:
>         name: "{{ item.Name }}"
>         state: stopped
>       with_items: "{{ nandhu.stdout }}"
> - name: STOP_Services_JS
>   hosts: jobserver
>   gather_facts: False
>   tasks:
>     - name: Stop services in Job servers
>       win_service:
>         name: DI_JOBSERVICE
>         state: stopped
>       register: service_status
>     - debug:
>         var: service_status.state
> - name: reboot the servers
>   hosts: cmsserver
>   gather_facts: False
>   tasks:
>     - name: reboot the CMS_servers
>       win_reboot:
>       when: service_status.state == 'stopped'
>       register: reboot_CMS
> - name: reboot the_Jobservers
>   hosts: jobserver
>   gather_facts: False
>   tasks:
>     - name: Reboot the Jobs servers
>       win_reboot:
>       register: reboot_Jobserver
>
> ***********************************************************************************************
> in First step ,i am trying to find the pagefile szie in windows servers 
> and changing the page file size as well.
> that is what the role "pagefile" does.
> Once the role is completed, services needs to be stopped in all servers in 
> sequence.
> first in CMS server group and then job_server group.
>
> Reboot has to be done,only the registered value is equal to "stopped"
>
> Here is the problem comes.
>  I am getting the registered variable as expected. however, reboot is not 
> happening and failing with undefined register varaible error
> Please help me to get the issue resolved
>
>
> Thanks,
> Nandhakumar
>
> On Fri, Aug 9, 2019 at 6:46 PM Angel Rengifo Cancino <[email protected] 
> <javascript:>> wrote:
>
>> Hi:
>>
>> El viernes, 9 de agosto de 2019, 7:49:13 (UTC-5), nandha kumar escribió:
>>>
>>> Hello Team,
>>>
>>> I am trying to use the variable in the following task which i registered 
>>> in the previous task.
>>> However, i am getting "variable is undefined error"
>>> Could you please suggest us,what could be the reason
>>>
>>
>> Please share as much details as possible of your code and the way you 
>> invoke it from CLI. We cannot guess!
>>
>> Thanks,
>>> Nandhakumar
>>>
>> -- 
>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/ecb14d22-1f56-4740-a818-594026103b93%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/ecb14d22-1f56-4740-a818-594026103b93%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/57879cab-7d2d-4665-92e7-dac93b63e788%40googlegroups.com.

Reply via email to