I tried to use the above command as per you suggestion and again got the
permission denied error.
fatal: [ma-idmspp-lapp565]: FAILED! => {"changed": true, "cmd": "find -L
/usr -executable -type f -name \"java\" -print", "delta": "0:00:01.458827",
"end": "2019-01-23 15:10:26.161587", "msg": "non-zero return code", "rc":
1, "start": "2019-01-23 15:10:24.702760", "stderr": "find:
'/usr/share/polkit-1/rules.d': Permission denied\nfind:
'/usr/libexec/initscripts/legacy-actions/auditd': Permission denied\nfind:
'/usr/tmp/lost+found': Permission denied\nfind:
'/usr/tmp/.ansible-c5023304': Permission denied\nfind:
'/usr/tmp/yum-root-a6LSso': Permission denied\nfind:
'/usr/tmp/systemd-private-8e020ca4b1d1423ea4e25c65b1f20330-ntpd.service-7jH9UJ':
Permission denied\nfind: '/usr/local/gcs_compliance': Permission
denied\nfind: '/usr/local/epic/cache': Permission denied\nfind:
'/usr/local/epic/log': Permission denied\nfind: '/usr/local/lib/asset':
Permission denied", "stderr_lines": ["find: '/usr/share/polkit-1/rules.d':
Permission denied", "find:
'/usr/libexec/initscripts/legacy-actions/auditd': Permission denied",
"find: '/usr/tmp/lost+found': Permission denied", "find:
'/usr/tmp/.ansible-c5023304': Permission denied", "find:
'/usr/tmp/yum-root-a6LSso': Permission denied", "find:
'/usr/tmp/systemd-private-8e020ca4b1d1423ea4e25c65b1f20330-ntpd.service-7jH9UJ':
Permission denied", "find: '/usr/local/gcs_compliance': Permission denied",
"find: '/usr/local/epic/cache': Permission denied", "find:
'/usr/local/epic/log': Permission denied", "find: '/usr/local/lib/asset':
Permission denied"], "stdout":
"/usr/java/jdk64-1.8.0_151/bin/java\n/usr/java/jdk64-1.8.0_151/jre/bin/java\n/usr/java/jre64-1.8.0_111/bin/java\n/usr/java/jre64-1.8.0_111/jre/bin/java",
"stdout_lines": ["/usr/java/jdk64-1.8.0_151/bin/java",
"/usr/java/jdk64-1.8.0_151/jre/bin/java",
"/usr/java/jre64-1.8.0_111/bin/java",
"/usr/java/jre64-1.8.0_111/jre/bin/java"]}
Kindly help.
Ruben
On Wednesday, 23 January 2019 20:09:25 UTC+5:30, Karl Auer wrote:
>
> It looks as if it's working. It is running the command "which java". The
> "which" command is unable to find an executable called "java" in the path,
> so it outputs an appropriate message to stderr and returns a non zero value.
>
> It looks as if you are trying to locate the java executable, but that will
> only work if the executable is in the shell's PATH. If you know what to add
> to the PATH variable, you probably no longer need to use which to find java
> :-)
>
> If you know roughly where it is, e.g., under /usr somewhere, you could use
> find to locate it:
>
> find -L /usr -executable -type f -name "java" -print
>
> But to be honest, if you will be running java, you probably need to know
> exactly which executable you should be running. Otherwise you will have to
> run a battery of tests to make sure that the executable you find is the
> right executable (version, architecture etc)
>
> Regards, K.
>
> On Thu, Jan 24, 2019 at 12:45 AM ruben melvin <[email protected]
> <javascript:>> wrote:
>
>> I tried removing the args and executable, then while trying to execute
>> again I am getting an error below.
>>
>> {"changed": true, "cmd": "which java", "delta": "0:00:00.074712", "end":
>> "2019-01-23 13:41:10.748039", "msg": "non-zero return code", "rc": 1,
>> "start": "2019-01-23 13:41:10.673327", "stderr": "which: no java in
>> (/usr/bin:/bin:/usr/sbin:/sbin)", "stderr_lines": ["which: no java in
>> (/usr/bin:/bin:/usr/sbin:/sbin)"], "stdout": "", "stdout_lines": []}
>>
>> Kindly help.
>> Ruben
>>
>> On Wednesday, 23 January 2019 02:06:43 UTC+5:30, Kai Stian Olstad wrote:
>>>
>>> On Tuesday, 22 January 2019 16:05:06 CET ruben melvin wrote:
>>> > Hi guys,
>>> >
>>> > I am trying to execute below ansible playbook.
>>> >
>>> > ---
>>> > - name: "checking the java version"
>>> > hosts: host
>>> > remote_user: myremoteuser
>>> > gather_facts: False
>>> > become: yes
>>> > become_user: serveruser
>>> > become_method: 'sudo'
>>> >
>>> > tasks:
>>> > - name: which java
>>> > shell: which java
>>> > args:
>>> > executable: /usr/java/
>>> > register: java
>>>
>>> Here you are trying to run the directory /usr/java/
>>> just remove the args and executable and it should work.
>>>
>>>
>>> --
>>> Kai Stian Olstad
>>>
>>>
>>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/527b1756-839f-4b6d-9660-ee6745f7aa71%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/ansible-project/527b1756-839f-4b6d-9660-ee6745f7aa71%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Karl Auer
>
> Email : [email protected] <javascript:>
> Website: http://2pisoftware.com
>
> GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
> Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA
>
--
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/8a6d42f6-e568-499c-a27c-e56cfb1f5a58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.