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:
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