Nice! However, your regex is also killing the underscore, and I need that.
I'm starting to monkey around with this, but I just don't know jinja, and
I bet you'll have the right magic sauce before I can puzzle it out :-)
Thanks!
On Friday, May 8, 2015 at 2:45:21 PM UTC-7, Matt Martz wrote:
>
> Because I would rather use jinja2 than piping through a bunch of shell
> commands:
>
> - name: Run java -version
> command: java -version
> register: java_version_out
> changed_when: false
>
> - name: Set java_version var
> set_fact: java_version="{{
> java_version_out.stderr.splitlines()[0]|regex_replace('[^\d.]+', '') }}"
>
> - debug: var=java_version
>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/7663c0de-1184-420f-a572-2d9629589f36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.