Use Ansible installation jdk1.8

Preparing the environment:

IP ## three virtual machines are as follows: 10.0.2.10,10.0.2.11,10.0.2.12 

## correspond respectively to change the host name: server01, Server02, server03

## configure ssh trust, Ali cloud yum source, turn off the firewall and selinux (omitted here)

Installation Ansible:

yum install -y ansible                               

## yum installation is complete, the default in / etc there will be corresponding folder

Installation jdk1.8:

## originally comes first kill openjdk

rpm -qa | grep jdk

rpm -e --nodeps java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64

rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.212.b04-0.el7_6.x86_64

vim /etc/ansible/hosts                               

## Add a host

cd /etc/ansible/roles

mkdir  -p jdk/files jdk/handlers jdk/tasks jdk/templates jdk/vars

cd jdk/

vim jdk.yml

cd files

## downloaded jdk package will be uploaded to this folder

cd tasks

vim main.yml

## In order to facilitate placed directly under the root, we may have seen the figure is zk, kafka, storm the environment variable, follow-up you know!

CD whose

vim main.yml

## Thus, the configuration phase is completed

ansible-playbook -i ../../hosts jdk.yml

After ## successful execution, java has been installed in the / root under

java -version

## look at the other two

## jdk1.8 installed successfully, if -bash appear: java: command not found, source just fine, or broken and then reconnected xshell View ok

source /etc/profile

Next update Ansible installation zookeeper! !

Published 21 original articles · won praise 5 · Views 413

Guess you like

Origin blog.csdn.net/weixin_41762839/article/details/104837704