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.



On Fri, Oct 24, 2014 at 1:59 PM, Jamal B <jm151...@gmail.com> wrote:

> 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?
>
> --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/96087981-b05d-482f-a30a-e9bbeb03715c%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/96087981-b05d-482f-a30a-e9bbeb03715c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwMTx0kbE8P2H1R6-Xk%3DtXzAwbVS9g54hBgJHQwBTQk9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to