# Vars from Script ?

**URL:** <https://forum.ansible.com/t/vars-from-script/13875>\
**Category:** Ansible Project\
**Created:** [November 9, 2013, 4:40pm UTC](https://forum.ansible.com/t/vars-from-script/13875 "2013-11-09T16:40:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andy\_L](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Andy\_L](https://forum.ansible.com/u/Andy_L)\
**Post date:** [November 9, 2013, 4:40pm UTC](https://forum.ansible.com/t/vars-from-script/13875/1 "2013-11-09T16:40:30Z")

</div>

I’ve got a situation where many provisioning vars are stored in a 3rd party app.

Is there a way to use the output of an external script to populate vars?

Something like:

- vars\_file: `my_script`

or

- vars\_script: my\_script

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Andy\_L](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Andy\_L](https://forum.ansible.com/u/Andy_L)\
**Post date:** [November 10, 2013, 2:08am UTC](https://forum.ansible.com/t/vars-from-script/13875/2 "2013-11-10T02:08:11Z")

</div>

OK my solution was to create a custom module that returns json with ansible\_facts.

tasks:

- local\_action: set\_variables  
sudo: false

---

<div class="post-metadata">

**Author:** ![rektide](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@rektide](https://forum.ansible.com/u/rektide)\
**Post date:** [November 14, 2013, 7:29am UTC](https://forum.ansible.com/t/vars-from-script/13875/3 "2013-11-14T07:29:49Z")

</div>

Glad you solved the problem. Please share with me what the solution was. I would like to know.

---

<div class="post-metadata">

**Author:** ![Andy\_L](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Andy\_L](https://forum.ansible.com/u/Andy_L)\
**Post date:** [November 14, 2013, 5:12pm UTC](https://forum.ansible.com/t/vars-from-script/13875/4 "2013-11-14T17:12:23Z")

</div>

JPM did a great writeup on this:

[http://jpmens.net/2012/07/15/ansible-it-s-a-fact/](http://jpmens.net/2012/07/15/ansible-it-s-a-fact/)
