Thanks for your help.  Nice Trick. Its working for me.

On Monday, 23 June 2014 17:41:21 UTC+5:30, Michael DeHaan wrote:
>
> That's not a valid variable name, so you'll have to attack it edgewise:
>
> {{ hostvars[inventory_hostname]["*ansible_devices"]["**cciss!c0d0"]["size"] 
> }}*
>
> *Usage of set_fact would allow assigning it to a cleaner variable name.*
>
>
>  
>
> On Mon, Jun 23, 2014 at 4:52 AM, Roopendra Vishwakarma <
> [email protected] <javascript:>> wrote:
>
>>  I am using gather fact variable to get size from ansible_devices 
>> variable. 
>> <http://docs.ansible.com/playbooks_variables.html#information-discovered-from-systems-facts>
>>  
>> for some host I am getting variable *"ansible_devices": { "sda"* and for 
>> few server getting 
>> *"ansible_devices": { "cciss!c0d0". *
>>
>>  *Problem:-* When I am using variable *{{** ansible_devices.sda.size }} *its 
>> working perfectly. But when I am trying to access value from {{ 
>> *ansible_devices.**cciss!c0d0.size }} *in my playbook then it is not 
>> returning any value whereas in json ansible_devices variable there is value 
>> exist for  *{{ ansible_devices.**cciss!c0d0.size }}.*
>>
>>  {
>>     "ansible_devices": {
>>         "cciss!c0d0": {
>>             "holders": [],
>>             "host": "RAID bus controller: Hewlett-Packard Company Smart 
>> Array Controller (rev 03)",
>>             "model": "LOGICAL VOLUME",
>>             "partitions": {},
>>             "removable": "0",
>>             "rotational": "1",
>>             "scheduler_mode": "cfq",
>>             "sectors": "143299800",
>>             "sectorsize": "512",
>>             "size": "68.33 GB",
>>             "support_discard": "0",
>>             "vendor": "HP"
>>         }
>>     },
>>     "item": ""
>> }
>>
>> It might be the case special character in a json key that's why I am 
>> unable to fetch its value. can anyone suggest me how can I access  *{{ 
>> ansible_devices.**cciss!c0d0.size }} *value here
>> * ?*
>>  
>> -- 
>> 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 post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/8a3184ab-fcc4-462b-aa28-4409f7a2264a%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/8a3184ab-fcc4-462b-aa28-4409f7a2264a%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/9c0ba27a-fd7b-488f-a17d-6d9df8acd35c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to