forked from rayduan/jenkinslib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
- hosts: "{{ hosts_name }}" | ||
user: [email protected] | ||
become: yes | ||
become_method: sudo | ||
tasks: | ||
- name: copy jdk to remote servers | ||
copy: src=/tmp/jdk-11.0.4_linux-x64_bin.tar.gz dest=/usr/local | ||
- name: depressing jdks | ||
shell: chdir=/usr/local tar xf jdk-11.0.4_linux-x64_bin.tar.gz | ||
# - name: rename jdk dirs | ||
# shell: mv /usr/local/jdk-11.0.4 /usr/local/java8 | ||
- name: add config to profile | ||
shell: /bin/echo {{ item }} >> /etc/profile | ||
with_items: | ||
- export JAVA_HOME=/usr/local/jdk-11.0.4 | ||
- export CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib | ||
- export PATH=\$JAVA_HOME/bin:\$PATH | ||
- name: take profile effect | ||
shell: source /etc/profile | ||
- name: add to bashrc | ||
shell: /bin/echo "source /etc/profile" >> ~/.bashrc | ||
tags: add_bashrc | ||
- name: take bashrc effect | ||
shell: source ~/.bashrc | ||
tags: source_bashrc | ||
- name: test | ||
shell: java -version | ||
tags: test_v | ||
- name: create a symbolic link for java11 | ||
shell: ln -s /usr/local/jdk-11.0.4/bin/java /usr/bin/java | ||
- name: test java version | ||
shell: java -version |