I think the following is roughly equivalent. I haven't tested it, so there
may be some tweaks needed.
{{ (arm_vm_details|selectattr('name', 'equalto',
vm_size)|first).maxDataDiskCount }}
On Tuesday, June 7, 2016, Trond Hindenes <[email protected]> wrote:
> btw, I'm able to do this if I use a separate template file:
> {% for vm in arm_vm_details %}
> {% if vm.name == vm_size %}
> print 'hello {{ vm.maxDataDiskCount }}'
> {% endif %}
> {% endfor %}
>
> However, that seems like an uneccessary number of steps, as I simply want
> to get to the correct values for my given vm size (name). If anyone
>
> On Tuesday, June 7, 2016 at 12:39:57 PM UTC+2, Trond Hindenes wrote:
>>
>> Hi have the following inside a variable:
>> [{u'maxDataDiskCount': 2,
>> u'memoryInMB': 3584,
>> u'name': u'Standard_DS1',
>> u'numberOfCores': 1,
>> u'osDiskSizeInMB': 1047552,
>> u'resourceDiskSizeInMB': 7168},
>> {u'maxDataDiskCount': 4,
>> u'memoryInMB': 7168,
>> u'name': u'Standard_DS2',
>> u'numberOfCores': 2,
>> u'osDiskSizeInMB': 1047552,
>> u'resourceDiskSizeInMB': 14336},
>> {u'maxDataDiskCount': 8,
>> u'memoryInMB': 14336,
>> u'name': u'Standard_DS3',
>> u'numberOfCores': 4,
>> u'osDiskSizeInMB': 1047552,
>> u'resourceDiskSizeInMB': 28672},
>> {u'maxDataDiskCount': 16,
>> u'memoryInMB': 28672,
>> u'name': u'Standard_DS4',
>> u'numberOfCores': 8,
>> u'osDiskSizeInMB': 1047552,
>> u'resourceDiskSizeInMB': 57344},
>> {u'maxDataDiskCount': 4,
>> u'memoryInMB': 14336,
>> u'name': u'Standard_DS11',
>> u'numberOfCores': 2,
>> u'osDiskSizeInMB': 1047552,
>> u'resourceDiskSizeInMB': 28672}]
>>
>> I need to get to a given object based on 'name'
>>
>> Sorry, this is probably super-easy but I'm strugglig like **** with
>> advanced jinja stuff.
>>
> --
> 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:_e(%7B%7D,'cvml','ansible-project%[email protected]');>
> .
> To post to this group, send email to [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/8844ebd1-39e7-4db2-9d5f-6bfb24713c79%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/8844ebd1-39e7-4db2-9d5f-6bfb24713c79%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Matt Martz
@sivel
sivel.net
--
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/CAD8N0v-K0WhajQjO1FLgJEiR11CHdKuovXzuFcpgWrpATci2Xw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.