Hello,
>> I have 10 no.of redhat 7.2 servers and I want to install  
 jdk-9.0.1_linux-x64_bin.tar.gz for all those servers and same time i wanna 
setup the java class path too.

you can achieve this task by following these options:

1) First of all you have to do the entry of your 10 redhat server in 
"/etc/ansible/hosts" file.
e.g;
[ RedhatServer ]
RedhatServer1
RedhatServer2
. . .
. . .
RedhatServer10

2) make above servers passwordless by using Openssh
eg;

step1: generate ssh key on your machine 
$ ssh-keygen

Step2: Copy your public key to the servers with ssh-copy-id:
$ ssh-copy-id -i ~/.ssh/id_rsa.pub "name@RedhatServer1"

3) use below playbook to deploy Java on all the given machines using source 
( tar.gz):


   - It will first download Java by using get_url module in /java folder 
   (you can give your own folder name here).
   - Then it will extract the java tar file by using unarchive module 
   within the java folder.
   - After extracting it will set the classpath to java.
   


---
- hosts: RedhatServer

  tasks:
  - name: Download Java
    get_url:
      url: 
http://download.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_linux-x64_bin.tar.gz
      dest: /java
      headers: Cookie: oraclelicense=accept-securebackup-cookie
     
 - name: Extract jdk-9.0.1_linux-x64_bin.tar.gz into /java
   unarchive:
    src: /java/jdk-9.0.1_linux-x64_bin.tar.gz
    dest: /java

  - name: setup the java class path
    command: export CLASSPATH="your classpath"


Thanks 
Soniya


On Monday, November 13, 2017 at 9:27:18 AM UTC+5:30, [email protected] 
wrote:
>
> Hi 
>
> I want to install java using its source (tar.gz) for number of redhat 
> servers . Can you please give me a little guide ? How can I use ansible for 
> this task and what are the command list ?
>
> For example : I have 10 no.of redhat 7.2 servers and I want to install  
>  jdk-9.0.1_linux-x64_bin.tar.gz for all those servers and same time i wanna 
> setup the java class path too.
>
>
> Thank you
> Luke
>
>

-- 
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/b9b594a8-1fe8-4499-bc13-54d8435d0347%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to