I've found the dictionary variable problem, there is a task register the 
same variable name as follows:

- name: register the variable
  register: nfsServer
  .....
  when: nfsServer is not defined

When I define the - { role: nfs-client, nfsServer: { 'ansible_facts': { 
'ansible_eth0' : { 'ipv4' : { 'address': 'hce.com' } } } } }, I thought the 
when checked it, the register should never be called, but no, the register 
is still being called, the vairable nfsServer I defined in the playbook is 
changed to be the registered variable which got contents of {u'skipped': 
True, u'changed': False}. If I commented the register statement out, it 
works.

The question is why the register can still be called even the when 
condition is in false status?



On Wednesday, January 7, 2015 10:00:29 PM UTC+11, hce h wrote:
>
>
> Hi Toshio,
>
>  
> On Wednesday, January 7, 2015 4:51:57 AM UTC+11, tkuratomi wrote:
>>
>> Are you able to post a small reproducer?  It would help to determine if 
>> this is a bug or not.
>>
> That problem only occurred on CentOS 6.5, it did not repeat in CentOS 7 
> and Ubuntu 14. I suspect that might be caused by different python version, 
> CentOS 6 uses python 2.6, both CentOS 7 and Ubuntu 14 use python 2.7. It 
> does not seem the bug in the ansible code, but it is fragile .
>
> Anyway, the original issue still remains in v1.8.2 although Tom said it 
> did not break in his site, I still could not get it work. Both CentOS 7 and 
> Ubuntu 14 got the same exception at - { role: nfs-client, nfsServer: { 
> 'ansible_facts': { 'ansible_eth0' : { 'ipv4' : { 'address': 'hce.com' } } 
> } } }
>
>
>
> Thanks Toshio.
>
> Thanks, Toshio
>> On Jan 5, 2015 5:59 PM, "hce h" <[email protected]> wrote:
>>
>>>
>>> I set up ansible_ssh_host=10.1.0.1 in my inventory file, but the 
>>> function def _get_host(self, hostname) in inventory __init__.py checks if 
>>> hostname == host.name, when the hostname is "ansible_ssh_host", it 
>>> cannot match and return None and exception. Is it a bug in 1.8.2?
>>>
>>>
>>> On Tuesday, January 6, 2015 10:28:37 AM UTC+11, hce h wrote:
>>>>
>>>> After updating to v1.8.2, I've got following error which was running 
>>>> fine in v1.7. I've got no idea what it stuck about, there is nothing 
>>>> changed except updating to 1.8.2, what could be possible wrong here?
>>>>
>>>> fatal: [nfsserver -> 127.0.0.1] => {'msg': 'Exception: host not found: 
>>>> ansible_ssh_host', 'failed': True}
>>>>
>>>> Thanks.
>>>>
>>>> -
>>>>
>>>> On Monday, January 5, 2015 6:59:25 PM UTC+11, hce h wrote:
>>>>>
>>>>> ve1.7, I am going to update to v1.8.2 and will see how it goes.
>>>>>
>>>>> Thanks Tom.
>>>>>
>>>>> - j
>>>>>
>>>>> On Monday, January 5, 2015 3:15:37 PM UTC+11, Tom Bamford wrote:
>>>>>>
>>>>>> What version of Ansible are you using? It works for me with v1.8.2. 
>>>>>> Even when referencing an undefined variable, I don't get an exception.
>>>>>>
>>>>>> Can you paste the nfs-client task which fails?
>>>>>>
>>>>>> Tom
>>>>>>
>>>>>>
>>>>>> On 5 January 2015 at 05:55, hce h <[email protected]> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I cannot install ansible to one of our NFS server, I tried to fake a 
>>>>>>> dictionary variable at following playbook:
>>>>>>>
>>>>>>> - { role: nfs-client, nfsServer: { 'ansible_facts': { 'ansible_eth0' 
>>>>>>> : { 'ipv4' : { 'address': 'hce.com' } } } } }
>>>>>>>
>>>>>>> The nfs-client tasks uses the variable nfsServer['ansible_facts'], 
>>>>>>> but I got following error, it cannot find dictionary variable 
>>>>>>> nfsServer['ansible_facts']:
>>>>>>>
>>>>>>> fatal: One or more undefined variables: 'dict' object has no 
>>>>>>> attribute 'ansible_facts'.
>>>>>>>
>>>>>>> What I was missing the syntax here?
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> - j
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  -- 
>>>>>>> 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 post to this group, send email to [email protected].
>>>>>>> To view this discussion on the web visit 
>>>>>>> https://groups.google.com/d/msgid/ansible-project/
>>>>>>> 995e60f0-a5f4-4a6c-971f-5dfd226f61d9%40googlegroups.com 
>>>>>>> <https://groups.google.com/d/msgid/ansible-project/995e60f0-a5f4-4a6c-971f-5dfd226f61d9%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>   -- 
>>> 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 post to this group, send email to [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/4f1fdaf8-f4e5-4404-9f09-0413ce820c52%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/ansible-project/4f1fdaf8-f4e5-4404-9f09-0413ce820c52%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e093b673-413d-452e-8eb4-a113aa807b7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to