# Variable Definition Question

**URL:** <https://forum.ansible.com/t/variable-definition-question/16600>\
**Category:** Ansible Project\
**Created:** [October 24, 2014, 5:59pm UTC](https://forum.ansible.com/t/variable-definition-question/16600 "2014-10-24T17:59:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jamal\_B](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@Jamal\_B](https://forum.ansible.com/u/Jamal_B)\
**Post date:** [October 24, 2014, 5:59pm UTC](https://forum.ansible.com/t/variable-definition-question/16600/1 "2014-10-24T17:59:47Z")

</div>

All, I’m new to Ansible so forgive me if this is already answered as I was unable to find a solution with my research.

I have an application which uses a Java properties file (/usr/local/app/app.properties) which contains key/value pairs like so:

THRESHOLD=75  
NUM\_THREADS=3  
REAPER\_COUNT=1

The application requires some environment setup which is currently performed by a shell script that I’m converting over to an Ansible playbook. I would like to reference the value of these properties in the tasks for the playbook like normal e.g.

- shell: app\_setup {{ THRESHOLD }}

but can’t seem to figure out a way to do so. I have tried the following to register the value of a property like so (which works):

- shell: grep THRESHOLD /usr/local/app/app.properties | cut -d “=” -f2  
register: THRESHOLD

But the above requires me to remember to use {{ THRESHOLD.stdout }} every time which I would like to avoid as I’m sure to forget this when used over time. I looked at the [Lookups](http://docs.ansible.com/playbooks_lookups.html)options in the documentation but do not see a way to use it to accomplish what I would like. Is there a way to register an Ansible variable from the value of a straight forward key/value file?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [October 25, 2014, 12:03am UTC](https://forum.ansible.com/t/variable-definition-question/16600/2 "2014-10-25T00:03:29Z")

</div>

You should probably define all the variables for the properties file instead, and maybe consider ansible templating the properties file as an ansible template to avoid dual entry.
