# var loaded from yaml file, and working with resulting data structure

**URL:** <https://forum.ansible.com/t/var-loaded-from-yaml-file-and-working-with-resulting-data-structure/28925>\
**Category:** Ansible Project\
**Created:** [November 2, 2018, 3:47am UTC](https://forum.ansible.com/t/var-loaded-from-yaml-file-and-working-with-resulting-data-structure/28925 "2018-11-02T03:47:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Will\_Dennis](https://avatars.discourse-cdn.com/v4/letter/w/919ad9/32.png) [@Will\_Dennis](https://forum.ansible.com/u/Will_Dennis)\
**Post date:** [November 2, 2018, 3:47am UTC](https://forum.ansible.com/t/var-loaded-from-yaml-file-and-working-with-resulting-data-structure/28925/1 "2018-11-02T03:47:43Z")

</div>

Hi all,

I am working on an idea for an Ansible role that installs CUDA, where I want to have a var consisting of a list of items with multiple key/value pairs (some values being lists of items.) So I came up with this YAML data structure, in a file I named cuda\_versions.yml:

`

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [November 2, 2018, 5:22am UTC](https://forum.ansible.com/t/var-loaded-from-yaml-file-and-working-with-resulting-data-structure/28925/2 "2018-11-02T05:22:09Z")

</div>

Instead of making cuda\_versions a list, make is a dict.

---

<div class="post-metadata">

**Author:** ![Will\_Dennis](https://avatars.discourse-cdn.com/v4/letter/w/919ad9/32.png) [@Will\_Dennis](https://forum.ansible.com/u/Will_Dennis)\
**Post date:** [November 2, 2018, 3:01pm UTC](https://forum.ansible.com/t/var-loaded-from-yaml-file-and-working-with-resulting-data-structure/28925/3 "2018-11-02T15:01:03Z")

</div>

Sometimes it’s the little things… thanks!
