In order to run java code I need to first set the classpath of dependent libraries by running a script setWLSEnv.sh as below:
$ . /app/wlserv*/server/bin/setWLSEnv.sh $ java weblogic.version
The output gives me the version of the product which I need.
I wrote the below playbook but it does not run the java code.
`
I found the solution myself. Here it is:
---
- hosts: dest_nodes
tasks:
- name: Get weblogic CLASSPATH
shell: "/app/wlserv*/server/bin/setWLSEnv.sh"
register: wlsenv
- name: Get weblogic Version
shell: "java weblogic.version"
environment:
CLASSPATH: "{{ wlsenv.stdout }}"
register: wlsversion
- debug:
msg: "{{ wlsversion }}