I want to register a variable with my java version. I can get that with:
java -version 2>&1 | head -1 | awk 'BEGIN { FS = "\"" } ; { print $2 }'
That gives me the result I want: 1.8.0_45
But I cannot make this happen in ansible :-( I'm going crazy with quotes
and escapes. I've tried:
- name: Get java version
shell: >
java -version 2>&1 | head -1 | awk 'BEGIN { FS = "\"" } ; { print
$2 }'
register: java_ver
and:
- name: Get java version
command: "{{ item }}"
with_items:
- java -version 2>&1 | head -1 | awk 'BEGIN { FS = "\"" } ; { print
$2 }'
register: java_ver
as well as trying various combinations of quotes and escape characters. I
just can't get the right recipe.
--
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/30e7016d-9285-424a-adb7-2fca96e87044%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.