-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
ff3ddc6
commit 449248b
Showing
8 changed files
with
225 additions
and
155 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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
[master] | ||
master ansible_host=147.182.174.211 ansible_user=root | ||
master ansible_host=137.184.107.91 ansible_user=root | ||
|
||
[nodes] | ||
node1 ansible_host=67.207.87.177 ansible_user=root | ||
node2 ansible_host=24.144.106.189 ansible_user=root | ||
node1 ansible_host=192.241.130.39 ansible_user=root | ||
node2 ansible_host=165.22.186.108 ansible_user=root | ||
|
||
[nfs_server] | ||
node2 ansible_host=24.144.106.189 ansible_user=root | ||
node2 ansible_host=165.22.186.108 ansible_user=root |
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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[artemis_servers] | ||
rockylinux ansible_host=137.184.107.91 ansible_user=root | ||
debian ansible_host=192.241.130.39 ansible_user=root | ||
ubuntu ansible_host=165.22.186.108 ansible_user=root | ||
debian ansible_host=157.245.130.56 ansible_user=root | ||
ubuntu ansible_host=134.209.77.220 ansible_user=root | ||
rockylinux ansible_host=142.93.56.4 ansible_user=root |
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
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 |
---|---|---|
@@ -1,30 +1,50 @@ | ||
--- | ||
- hosts: java_servers | ||
become: yes | ||
- name: Install and configure Java 17 on multiple OS families | ||
hosts: all | ||
become: true | ||
vars_files: | ||
- vars.yml | ||
|
||
tasks: | ||
- name: Install Java on RHEL-based systems | ||
include_role: | ||
name: geerlingguy.java | ||
vars: | ||
java_packages: | ||
- java-11-openjdk | ||
- java-11-openjdk-devel | ||
when: ansible_os_family == 'RedHat' | ||
|
||
- name: Install Java on Debian-based systems | ||
include_role: | ||
name: geerlingguy.java | ||
vars: | ||
java_packages: | ||
- openjdk-17-jdk | ||
- default-jdk | ||
- default-jre | ||
when: ansible_os_family == 'Debian' | ||
|
||
- name: Install Java on Ubuntu systems | ||
include_role: | ||
name: geerlingguy.java | ||
vars: | ||
java_packages: | ||
- openjdk-11-jdk | ||
when: ansible_distribution == 'Ubuntu' | ||
- name: Install Java 17 on Debian-based systems | ||
ansible.builtin.apt: | ||
name: openjdk-17-jdk | ||
state: present | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Install Java 17 on RedHat-based systems | ||
ansible.builtin.yum: | ||
name: java-17-openjdk | ||
state: present | ||
when: ansible_os_family == "RedHat" | ||
|
||
- name: Identify Java 17 path on Debian-based systems | ||
ansible.builtin.shell: "update-alternatives --list java | grep 'java-17'" | ||
register: debian_java_path | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Identify Java 17 path on RedHat-based systems | ||
ansible.builtin.shell: "update-alternatives --list | grep 'java-17'" | ||
register: redhat_java_path | ||
when: ansible_os_family == "RedHat" | ||
|
||
- name: Set Java 17 as the default alternative on Debian-based systems | ||
community.general.alternatives: | ||
name: java | ||
path: "{{ debian_java_path.stdout }}" | ||
priority: 100 | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Set Java 17 as the default alternative on RedHat-based systems | ||
community.general.alternatives: | ||
name: java | ||
path: "{{ redhat_java_path.stdout }}" | ||
priority: 100 | ||
when: ansible_os_family == "RedHat" | ||
|
||
- name: Verify Java 17 installation | ||
ansible.builtin.command: java -version | ||
register: java_version | ||
|
||
- name: Display Java version | ||
ansible.builtin.debug: | ||
msg: "Java installed successfully. Version: {{ java_version.stdout_lines }}" |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[java_servers] | ||
rockylinux ansible_host=137.184.143.123 ansible_user=root | ||
debian ansible_host=165.22.3.122 ansible_user=root | ||
ubuntu ansible_host=159.223.131.6 ansible_user=root | ||
debian ansible_host=157.245.130.56 ansible_user=root | ||
ubuntu ansible_host=134.209.77.220 ansible_user=root | ||
rockylinux ansible_host=142.93.56.4 ansible_user=root |
Oops, something went wrong.