# set, read, and use vars from csv or csv2yml file

**URL:** <https://forum.ansible.com/t/set-read-and-use-vars-from-csv-or-csv2yml-file/30944>\
**Category:** Ansible Project\
**Created:** [August 4, 2019, 2:13pm UTC](https://forum.ansible.com/t/set-read-and-use-vars-from-csv-or-csv2yml-file/30944 "2019-08-04T14:13:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerard\_moisset](https://avatars.discourse-cdn.com/v4/letter/g/48db29/32.png) [@gerard\_moisset](https://forum.ansible.com/u/gerard_moisset)\
**Post date:** [August 4, 2019, 2:13pm UTC](https://forum.ansible.com/t/set-read-and-use-vars-from-csv-or-csv2yml-file/30944/1 "2019-08-04T14:13:31Z")

</div>

i’m trying to write playbook to downlaod packages from repo.

here is my try.

csv data

---

<div class="post-metadata">

**Author:** ![Andrew\_Feller](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@Andrew\_Feller](https://forum.ansible.com/u/Andrew_Feller)\
**Post date:** [August 4, 2019, 3:39pm UTC](https://forum.ansible.com/t/set-read-and-use-vars-from-csv-or-csv2yml-file/30944/2 "2019-08-04T15:39:52Z")

</div>

Consider creating a custom vars plugin  
[https://docs.ansible.com/ansible/latest/dev\_guide/developing\_plugins.html](https://docs.ansible.com/ansible/latest/dev_guide/developing_plugins.html)

---

<div class="post-metadata">

**Author:** ![dan\_linder](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dan_linder/32/3833_2.png) [@dan\_linder](https://forum.ansible.com/u/dan_linder)\
**Post date:** [August 4, 2019, 5:08pm UTC](https://forum.ansible.com/t/set-read-and-use-vars-from-csv-or-csv2yml-file/30944/3 "2019-08-04T17:08:25Z")

</div>

What is the exact error message you’re getting?

I only slightly agree with Mr. Fellers response (“create a custom vars plugin”), but in your case that might be overkill. I’ve seen teams that have a developer write some custom code that breaks soon after he/she leaves and then they are stuck with a bigger mess than if they had tried to work with Ansible included modules.

---

<div class="post-metadata">

**Author:** ![Andrew\_Feller](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@Andrew\_Feller](https://forum.ansible.com/u/Andrew_Feller)\
**Post date:** [August 4, 2019, 5:22pm UTC](https://forum.ansible.com/t/set-read-and-use-vars-from-csv-or-csv2yml-file/30944/4 "2019-08-04T17:22:39Z")

</div>

If you’re having to write Python code already, you’re most of the way to having a custom plugin. You’re simply doing it in a way that natively hooks into how Ansible works.
