I am using gather fact variable to get size from ansible_devices variable. 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
.sizeits working perfectly. But when I am trying to access value from {{
ansible_devices.
in my playbook cciss!c0d0
.size }}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": ""
}
{{ ansible_devices.
cciss!c0d0
.size }}
value here
?
ansible_devices"]["
cciss!c0d0"]["
size"] }}
Usage of set_fact would allow assigning it to a cleaner variable name.
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8a3184ab-fcc4-462b-aa28-4409f7a2264a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.