Make a list of possible places that a java executable might be, in order of
preference, and work through the list checking each location in turn. Or
use the shell command I gave you last week to search an entire directory
tree for java executables; checking a list of possible candidates will be a
I am actually not supposed to add or set anything on that server as it is a
production server. So setting environment is not an option for me.
I just need to know the java version using ansible so that it will help me
a lot in reducing the manual works of my teammates.
I tried out using the
Either you can set/edit default PATH for java bin in /etc/sudoers (visudo)
by editing
Defaultssecure_path = /sbin:/bin:/usr/sbin:/usr/bin
Or you can set environment while executing ansible-playbook
---
- name: "checking the java version"
hosts: host
remote_user: myremoteuser